home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / batpwr02.zip / BATPWR02.610 < prev    next >
Text File  |  1996-10-02  |  419KB  |  10,309 lines

  1. ─ Area: Batch Language Programming                     FI ────────────────────
  2.   Msg#: 423                                          Date: 27 Feb 96  23:40:00
  3.   From: Vernon Frazee                                Read: Yes    Replied: No
  4.     To: Furlan Primus                                Mark:
  5.   Subj: L-O-N-G PATH          1/2
  6. ──────────────────────────────────────────────────────────────────────────────
  7. VF> BTW, I have shown more than a few folks how a PATH of up to at least
  8. VF> 4,096 bytes (yep, that's four-thousand-and-ninety-six characters)
  9. VF> can be created and successfully used... using nothing more than DOS.
  10.  
  11. FP> i have always kept my PATH to the mininum needed as a matter of
  12. FP> choice
  13.  
  14.     Same on this end (it's faster).
  15.  
  16. FP> and just exactly HOW do you do the above anyway???
  17.  
  18.     --------------------------------------------------------------------
  19.     L-o-n-g PATH "how to" for MS-DOS version 6.nn (any version of DOS 6)
  20.     --------------------------------------------------------------------
  21.  
  22.     Normally, on most MS-DOS v6.xx systems, when the system boots it
  23.     looks for and loads/runs the following five files -- in this order:
  24.  
  25.       1) IO.SYS       - basic Input/Output routines
  26.       2) MSDOS.SYS    - basic MicroSoft Disk Operating System routines
  27.       3) CONFIG.SYS   - user created ASCII file (drivers, etc.)
  28.       4) COMMAND.COM  - command line processor
  29.       5) AUTOEXEC.BAT - user created ASCII file (whatever)
  30.  
  31.     The 4th step, loading COMMAND.COM, is what limits the command line,
  32.     and hence the "PATH=..." line length in AUTOEXEC.BAT, to a maximum
  33.     of 127 characters.
  34.  
  35.     The 'secret' to creating a l-o-n-g PATH then is to set it up in
  36.     CONFIG.SYS -- before COMMAND.COM's 127 character line limit has
  37.     come in to play -- instead of in AUTOEXEC.BAT.
  38.  
  39.     Setting up a PATH in CONFIG.SYS only works, (I believe), in MS-DOS
  40.     v6.xx or higher and uses the following syntax:
  41.  
  42.       SET PATH=drive:\directory[;drive:\directory][;...]
  43.  
  44.     Tip: All of the following examples will NOT work in CONFIG.SYS like
  45.          they do in AUTOEXEC.BAT:
  46.  
  47.            PATH=...     PATH=%PATH%;...     SET PATH=%PATH%;...
  48.            PATH ...     PATH %PATH%;...     SET PATH %PATH%;...
  49.  
  50.          In other words, if the line doesn't begin with "SET PATH=", DOS
  51.          will return something like "Error in CONFIG.SYS line 1".
  52.  
  53.          The %PATH% idea also fails because the program that defines and
  54.          understands such, COMMAND.COM, has not been loaded yet.
  55.  
  56.     PATH lengths of up to a whopping 4,096 characters have been tested
  57.     here, with success, using this "CONFIG.SYS" "SET PATH=..." approach.
  58.  
  59.     --------------------------------------------------------------------
  60.                 [ ... text deleted for brevity ... ]
  61.  
  62. -!-
  63.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  64.  
  65.  
  66. ─ Area: Batch Language Programming                     FI ────────────────────
  67.   Msg#: 431                                          Date: 04 Mar 96  13:28:05
  68.   From: Vernon Frazee                                Read: Yes    Replied: No
  69.     To: Carlo Mosti                                  Mark:
  70.   Subj: Daily execution
  71. ──────────────────────────────────────────────────────────────────────────────
  72. CM> I would like to know if someone knows of a way to resolve my problem
  73. CM> by using only batchfile commands. I want to execute a program
  74. CM> everyday but only once! How do I control that?
  75.  
  76.     Here's one that does it by storing the command you entered plus the
  77.     current system date on one line at the end of the BATch file itself.
  78.     When you launch it again it simply looks for an identical command-
  79.     line/date.  (If one is found it tells you that command has already
  80.     been run today.  If no match is found, it adds the command and date
  81.     to the end of the file and continues).
  82.  
  83.     Note: Because this is a self-modifying BATch file, you may need to
  84.           change all occurances of "C:\BAT" to the location of where you
  85.           intend on keeping it on your hard drive.
  86.  
  87. @echo off
  88. :ONCEADAY.BAT runs a specified program once-a-day only -----------------
  89. :Notes: This BATch file is self modifying!  It keeps track of every date
  90. :       and the command(s) issued on that date at end of this file.
  91. :       Requires DOS's FIND (somewhere in current PATH is fine).
  92. :       Use "CURRENT /C" (not the quotes) to clear all dates from file.
  93. :-----------------------------------------------------------------------
  94.  if (%1%2)==(dateis) goto GOTIT
  95.  if (%1)==(/?) goto SYNTAX
  96.  if (%1)==() goto SYNTAX
  97.  for %%x in (:) do set colons=%%x%%x
  98.  for %%x in (c C) do if (%1)==(/%%x) goto CLEAR
  99.  set program=%1 %2 %3 %4
  100.  ver|date>temptemp.bat
  101.  echo %0 %%1 %%2 %%3 %%4>current.bat
  102.  temptemp
  103. :GOTIT -----------------------------------------------------------------
  104.  set date=%4
  105.  find /c "%colons%%4%program%" C:\BAT\%0.BAT>temptemp.bat
  106.  echo set current=%%2>--------.bat
  107.  call temptemp.bat
  108.  if (%current%)==(0) echo %colons%%date%%program%>>C:\BAT\%0.BAT
  109.  if (%current%)==(0) goto DO_IT
  110.  echo Command: %program%
  111.  echo          has already been run today.
  112.  goto CLEANUP
  113. :DO_IT -----------------------------------------------------------------
  114.  cls
  115.  echo Issuing command: %program% ...
  116.  echo.
  117.  call %program%
  118.  goto CLEANUP
  119. :CLEAR -----------------------------------------------------------------
  120.  type C:\BAT\%0.BAT|find /v "%colons%">C:\BAT\%0.BAT
  121. :CLEANUP ---------------------------------------------------------------
  122.  for %%x in (-------- temptemp current) do if exist %%x.bat del %%x.bat
  123.  for %%x in (program colons current date) do set %%x=
  124.  goto END
  125. :SYNTAX ----------------------------------------------------------------
  126.  cls
  127.  echo.
  128.  echo    Name: ONCEADAY.BAT
  129.  echo.
  130.  echo  Author: Vernon Frazee 03/03/94
  131.  echo.
  132.  echo Purpose: Run specified command only once a day.
  133.  echo.
  134.  echo  Syntax: ONCEADAY program_name/command [parm_1] [parm_2] [parm_3]
  135.  echo.
  136.  echo          ONCEADAY /C  clears all entries
  137.  echo.
  138.  echo          ONCEADAY /?  displays this help
  139.  echo.
  140.  echo Example: ONCEADAY DEFRAG C: /F /SN
  141.  echo.
  142.  echo   Notes: Requires DOS's FIND (must be available in current PATH)
  143.  echo.
  144.  echo          Requires at least approx 50 bytes free environment space
  145.  echo.
  146.  echo          ONCEADAY.BAT is self modifying!  (It keeps track of when
  147.  echo                       and what was run at the end of the file).
  148.  echo.
  149.  goto END
  150. :END (Data storage begins below) --------------------------------- -vjf-
  151.  
  152.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  153.  
  154. -!- OLMS 2.53p+ [ERSBN55C]
  155.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  156.  
  157. ─ Area: Batch Language Programming                     FI ────────────────────
  158.   Msg#: 390                                          Date: 04 Mar 96  21:52:00
  159.   From: Roy Reed                                     Read: Yes    Replied: No
  160.     To: All                                          Mark:
  161.   Subj: Counting file lines
  162. ──────────────────────────────────────────────────────────────────────────────
  163.  LD>> I want this batch to make a list of %1 <EG: *.bat or *.txt>
  164.  
  165.  LD>> then use the list to count the lines in each found
  166.  
  167.  LD>> then report to some file, the found file name(s) and the # of
  168. lines
  169.  LD>> EG: somefile.txt 27
  170.  
  171.  LD>>     othrfile.txt 13
  172.  
  173.  LD>>     yetnothr.txt 29
  174.  
  175.  
  176.  
  177. I used SORT and FIND from DOS, and Michael Mefford's CHANGE.COM in the
  178. following batch file to group extension_requested files of the current
  179. directory in a list and count their lines.
  180.  
  181. After running this file 12 times, you'll get a file creation error on
  182. the 13th run.  Anybody know why?  Something with the FIND command
  183. or FOR IN DO or CALL?  My el cheapo 486?
  184. If I change the do find in the for-in-do to do call find, it bombs on
  185. the 9th try.
  186.  
  187. REM countext.bat
  188. @echo off
  189. if "%1"== "" goto syntax
  190. set fn=-%1
  191. if exist $!&)list del $!&)list
  192. for %%x in (*.%1) do find /c /v "<^>#~" %%x >>$!&)list
  193. call change $!&)list 13,10,45,45,45,45,45,45,45,45,45,45 "" > nul
  194. call change $!&)list ":" "" > nul
  195. call sort < $!&)list > %fn%list
  196. del $!&)list
  197. set fn=
  198. goto end
  199. :syntax
  200. echo.
  201. echo enter  countext ext  of filenames you want linecounts of
  202. echo example - countext txt, or countext doc, or countext bat, etc.
  203. echo filenames and linecounts will be in file -extlist
  204. :end
  205. ::---------------RCR--------------
  206.                            Part 1
  207.  
  208. -!- PCBoard (R) v15.22 (OS/2) 10
  209.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  210.  
  211. ─ Area: Batch Language Programming                     FI ────────────────────
  212.   Msg#: 391                                          Date: 04 Mar 96  21:54:00
  213.   From: Roy Reed                                     Read: Yes    Replied: No
  214.     To: All                                          Mark:
  215.   Subj: Counting file lines
  216. ──────────────────────────────────────────────────────────────────────────────
  217. Here is another version named extcount.bat using PREFIX.COM
  218. from DOSWORLD magazine.
  219.  
  220. @echo off
  221. if not "%4"== "" goto wrapitup
  222. if "%1"== "almost_done" goto shrink
  223. if "%1"== "" goto syntax
  224. set fn=-%1
  225. if exist $!&)list.bat del $!&)list.bat
  226. if exist %fn%list del %fn%list
  227. for %%x in (*.%1) do call %0 almost_done %%x
  228. call sort < %fn%list > po-trait
  229. del %fn%list
  230. ren po-trait %fn%list
  231. for %%y in (fn name) do set %%y=
  232. goto end
  233. :wrapitup
  234. echo %name% %4 >> %fn%list
  235. if exist $!&)list.bat del $!&)list.bat
  236. goto end
  237. :shrink
  238. set name=%2
  239. echo. | find /c /v "<^>#~" %name% | find "----------" | ...
  240. ... prefix extcount plop >>$!&)list.bat
  241. call $!&)list
  242. goto end
  243. :syntax
  244. echo enter extcount and extension of files you want individual count of
  245. :end
  246. ::---------------RCR--------------
  247.  
  248. In extcount.bat, assemble the two lines with ... together at that point
  249.  
  250. Here is the PREFIX.SCR to DEBUG < PREFIX.SCR to obtain prefix.com
  251.  
  252. N PREFIX.COM
  253. A
  254. PUSH CS
  255. POP DS
  256. MOV DX,0157
  257. MOV [0155],DX
  258. MOV AH,3F
  259. MOV BX,0000
  260. MOV CX,0001
  261. MOV DX,[0155]
  262. INC WORD PTR [0155]
  263. INT 21
  264. CMP AX,0000
  265. JNZ 0125
  266. MOV AX,4C00
  267. INT 21
  268. PUSH DX
  269. POP SI
  270. MOV AH,[SI]
  271. CMP AH,0A
  272. JZ 0130
  273. JMP 0109
  274. PUSH AX
  275. MOV BX,0001
  276. XOR CH,CH
  277. MOV CL,[0080]
  278. MOV DX,0081
  279. MOV AH,40
  280. INT 21
  281. MOV AH,40
  282. MOV BX,0001
  283. MOV CX,[0155]
  284. SUB CX,0157
  285. MOV DX,0157
  286. INT 21
  287. JMP 0102
  288.  
  289. RCX
  290. 155
  291. W
  292. Q
  293.  
  294. Try, for example; DIR |prefix put me first >> zzz
  295.                               Part 2
  296.  
  297. -!- PCBoard (R) v15.22 (OS/2) 10
  298.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  299.  
  300. ─ Area: Batch Language Programming                     FI ────────────────────
  301.   Msg#: 392                                          Date: 04 Mar 96  21:55:00
  302.   From: Roy Reed                                     Read: Yes    Replied: No
  303.     To: All                                          Mark:
  304.   Subj: COUNTING FILE LINES
  305. ──────────────────────────────────────────────────────────────────────────────
  306. This will count the lines in one file.  Submitted to see how badly
  307. Vernon Frazee will "in my face" me with his faster two-liner.  But
  308. I do honor the king.
  309.  
  310. @echo off
  311. if "%2"=="felines" goto felines
  312. if "%1"=="" goto namepls
  313. set fn=%1
  314. find /c /v "<^>#~" %1 > (^^--^^).bat
  315. call change (^^--^^).bat 13,10,45,45,45,45,45,45,45,45,45,45 "felines
  316. felines felines" > nul
  317. echo.
  318. (^^--^^) > nul
  319. :felines
  320. echo file %fn% has %4 lines
  321. goto end
  322. :namepls
  323. echo proper syntax is felines filename
  324. echo this finds # of lines in named file
  325. :end
  326.  set fn=
  327. del (^^--^^).bat
  328.  
  329. -!- PCBoard (R) v15.22 (OS/2) 10
  330.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  331.  
  332. ─ Area: Batch Language Programming                     FI ────────────────────
  333.   Msg#: 424                                          Date: 05 Mar 96  09:17:01
  334.   From: Vernon Frazee                                Read: Yes    Replied: No
  335.     To: Stephan Hoppe                                Mark:
  336.   Subj: Get date?
  337. ──────────────────────────────────────────────────────────────────────────────
  338. SH> What I'd like to do is have a plain vanilla batch file that grabs
  339. SH> the day of the month so that on the 3rd, for example, I could defrag
  340. SH> my HD, on the 4th run scandisk, etc. etc.
  341. SH> I figure it would have to be something that grabs the day of the
  342. SH> month as an env variable then the calling batch files would check
  343. SH> this to see if its the right day.
  344. SH> How to grab the variable?
  345. SH> Please no 4dos, ndos or whatever. . .just MS-DOS.
  346.  
  347.     Here's one way to get the current system Month, Day, and Year, into
  348.     separate environment variables (evars) using DOS's CHOICE.COM.
  349.  
  350.       @echo off
  351.       :---------------------------------------------------
  352.       :    Name: MDY.BAT - For US DATE format (mm-dd-yyyy)
  353.       : Purpose: Using current system date, put 2-digit
  354.       :          month in evar MM, 2-digit day in evar DD,
  355.       :          and 2-digit year in evar YY.
  356.       :Requires: CHOICE.COM and 36 bytes in environment.
  357.       :---------------------------------------------------
  358.        if (%1)==(![) goto ParseIt
  359.        for %%x in (mm dd yy mdy) do set %%x=
  360.        >~tmp~.bat ver|date
  361.        echo set mdy=%%4>current.bat
  362.        for %%x in (call del) do %%x ~tmp~.bat
  363.        del current.bat
  364.        >~tmp~.bat echo;;|choice/c:;%mdy%; "%0 !"
  365.        ~tmp~.bat
  366.       :ParseIt -------------------------------------------
  367.        set mm=%2%3|set dd=%5%6
  368.        shift|shift
  369.        set yy=%8%9|echo MM=%mm%
  370.        echo DD=%dd%
  371.        echo YY=%yy%
  372.        del ~tmp~.bat|set mdy=
  373.       :End ----------------------------------------- -vjf-
  374.  
  375.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  376.  
  377. -!- OLMS 2.53p+ [ERSBN55C]
  378.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  379.  
  380. ─ Area: Batch Language Programming                     FI ────────────────────
  381.   Msg#: 428                                          Date: 05 Mar 96  03:38:00
  382.   From: Vernon Frazee                                Read: Yes    Replied: No
  383.     To: Richard Dale                                 Mark:
  384.   Subj: Humongous project
  385. ──────────────────────────────────────────────────────────────────────────────
  386. RD> M:\USERS\74801000>fwcopy 74801000 phone.001
  387.  
  388. VF> The enclosed examples should help you get started
  389.  
  390. RD> I thank you very kindly! I shall let you know on the results.
  391.  
  392.     You're more than welcome, and yes, please do.
  393.  
  394. RD> FWIW, "fwcopy" copies the files over to be used by the Ft. Worth
  395. RD> office, hence "fw".  The command that is *really* supposed to be
  396. RD> used is CLEAN 74801000 PHONE.001, but if I mess up and clean
  397. RD> PHONE.001 again within 5 minutes or so, it can crash or slow down
  398. RD> the system.  Sheesh!<tm>.
  399.  
  400.     The following might help solve that particular problem.  It only
  401.     allows the exact same command to be run once per day.
  402.  
  403. @echo off
  404. :ONCEADAY.BAT runs a specified program once-a-day only -----------------
  405. :Notes: This BATch file is self modifying!  It keeps track of every date
  406. :       and the command(s) issued on that date at end of this file.
  407. :       Requires DOS's FIND (somewhere in current PATH is fine).
  408. :       Use "CURRENT /C" (not the quotes) to clear all dates from file.
  409. :-----------------------------------------------------------------------
  410.  if (%1%2)==(dateis) goto GOTIT
  411.  if (%1)==(/?) goto SYNTAX
  412.  if (%1)==() goto SYNTAX
  413.  for %%x in (:) do set colons=%%x%%x
  414.  for %%x in (c C) do if (%1)==(/%%x) goto CLEAR
  415.  set program=%1 %2 %3 %4
  416.  ver|date>temptemp.bat
  417.  echo %0 %%1 %%2 %%3 %%4>current.bat
  418.  temptemp
  419. :GOTIT -----------------------------------------------------------------
  420.  set date=%4
  421.  find /c "%colons%%4%program%" C:\BAT\%0.BAT>temptemp.bat
  422.  echo set current=%%2>--------.bat
  423.  call temptemp.bat
  424.  if (%current%)==(0) echo %colons%%date%%program%>>C:\BAT\%0.BAT
  425.  if (%current%)==(0) goto DO_IT
  426.  echo Command: %program%
  427.  echo          has already been run today.
  428.  goto CLEANUP
  429. :DO_IT -----------------------------------------------------------------
  430.  cls
  431.  echo Issuing command: %program% ...
  432.  echo.
  433.  call %program%
  434.  goto CLEANUP
  435. :CLEAR -----------------------------------------------------------------
  436.  type C:\BAT\%0.BAT|find /v "%colons%">C:\BAT\%0.BAT
  437. :CLEANUP ---------------------------------------------------------------
  438.  for %%x in (-------- temptemp current) do if exist %%x.bat del %%x.bat
  439.  for %%x in (program colons current date) do set %%x=
  440.  goto END
  441. :SYNTAX ----------------------------------------------------------------
  442.  cls
  443.  echo.
  444.  echo    Name: ONCEADAY.BAT
  445.  echo.
  446.  echo  Author: Vernon Frazee 03/03/94
  447.  echo.
  448.  echo Purpose: Run specified command only once a day.
  449.  echo.
  450.  echo  Syntax: ONCEADAY program_name/command [parm_1] [parm_2] [parm_3]
  451.  echo.
  452.  echo          ONCEADAY /C  clears all entries
  453.  echo.
  454.  echo          ONCEADAY /?  displays this help
  455.  echo.
  456.  echo Example: ONCEADAY DEFRAG C: /F /SN
  457.  echo.
  458.  echo   Notes: Requires DOS's FIND (must be available in current PATH)
  459.  echo.
  460.  echo          Requires at least approx 50 bytes free environment space
  461.  echo.
  462.  echo          ONCEADAY.BAT is self modifying!  (It keeps track of when
  463.  echo                       and what was run at the end of the file).
  464.  echo.
  465.  goto END
  466. :END (Data storage begins below) --------------------------------- -vjf-
  467.  
  468. RD> Thanks again.
  469.  
  470.     No problem.  Let me know how you make out.
  471.  
  472.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  473.  
  474. -!- OLMS 2.53p+ [ERSBN55C]
  475.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  476.  
  477. ─ Area: Batch Language Programming                     FI ────────────────────
  478.   Msg#: 430                                          Date: 06 Mar 96  18:32:00
  479.   From: Vernon Frazee                                Read: Yes    Replied: No
  480.     To: Larry Kwiatkowski                            Mark:
  481.   Subj: Caps in ENV
  482. ──────────────────────────────────────────────────────────────────────────────
  483. WE> you need a lot of if-statements to ask for all possiblities ...
  484. WE>   set variable=example
  485. WE>   set variable=Example
  486. WE>   set variable=EXAmple
  487. WE> It would be much easier if I could change the content of an
  488. WE> environment variable to either small or capital letters.
  489.  
  490. LK> I use a rather complicated routine to do exactly that - map the file
  491. LK> names to all caps - using GET.EXE and QEDIT. I hope there is some
  492. LK> simpler way to accomplish mapping to all caps. Does anyone have a
  493. LK> workable solution?
  494.  
  495.     Here's a fairly simple "COMMAND.COM only" example:
  496.  
  497.       @echo off
  498.       :---------------------------------------------------
  499.       :UP-CASE.BAT - UPPERcases user parameters
  500.       :              (up to about 49 characters)
  501.       : For example: up-case WiLe e cOyOtE
  502.       :     returns: WILE E COYOTE
  503.       :        Note: Results stored in evar UP-CASE
  504.       :---------------------------------------------------
  505.        if (%1)==() goto End
  506.        path>~savpath.bat
  507.        for %%x in (up-case path) do set %%x=
  508.       :Loop ----------------------------------------------
  509.        path %1
  510.        if not (%up-case%)==() set up-case=%up-case% %path%
  511.        if (%up-case%)==() set up-case=%path%
  512.        shift
  513.        if not (%1)==() goto Loop
  514.        echo %up-case%
  515.        for %%x in (call del) do %%x ~savpath.bat
  516.       :End ----------------------------------------- -vjf-
  517.  
  518.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  519.  
  520. -!- OLMS 2.53p+ [ERSBN55C]
  521.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  522.  
  523. ─ Area: Batch Language Programming                     FI ────────────────────
  524.   Msg#: 402                                          Date: 08 Mar 96  23:14:04
  525.   From: Dennis Mccunney                              Read: Yes    Replied: No
  526.     To: Greg Paksi                                   Mark:
  527.   Subj: Two OS's on one drive?
  528. ──────────────────────────────────────────────────────────────────────────────
  529.  ** From Greg Paksi to Brian Altenpohl on 29 Feb 96  16:53:54
  530.  ** Re: Two OS's on one drive?
  531.  
  532.  BA> Also, you may want to take a look into QNX, it is a great O/S, and
  533.  BA> comes with the QNX loader, which will allow you up to 4 different OSs
  534.  BA> on a  single machine.  Perhaps newer version of QNX will allow more.
  535.  BA> Or you could write a simple Boot-Manager program - it isn't very
  536.  
  537.  GP> What's QNX?  How is it different than DOS, UNIX, OS/2, WINDOWS NT,
  538.  GP> etc.?
  539.  
  540.     QNX is an operating system from a company in Canada called QNX
  541.  (formerly known as Quantum).  It began as a UNIX-like OS optimised to
  542.  run on Intel CPUs (and would run reasonably on XTs and well on ATs).
  543.  It has evolved into an OS aimed at the real-time market, with built-in
  544.  network awareness.
  545.  
  546.  
  547.  
  548. -!- Blue Wave/DOS v2.30
  549.  ! Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/304)
  550.  
  551. ─ Area: Batch Language Programming                     FI ────────────────────
  552.   Msg#: 448             Local                        Date: 11 Mar 96  18:30:57
  553.   From: Bat Lang                                     Read: Yes    Replied: No
  554.     To: Steve Meech                                  Mark:
  555.   Subj: Copying files
  556. ──────────────────────────────────────────────────────────────────────────────
  557.  -=> Quoting Steve Meech to All, [09 Mar 96  00:29:06] <=-
  558.  
  559.  SM> Anyway, back on topic, the problem is that I have to transfer 13Mb of
  560.  SM> files, many of which don't change from one day to the next.
  561.  
  562.  SM> Is there a way of copying only those files which are _different_ on
  563.  SM> the two machines, to save time (in the way PKZIP's "update" function
  564.  SM> does).
  565.  SM> I'd be interested in a batch-file or utility solution.
  566.                                        ^^^^^^^^^^^^^^^^^^^
  567.  
  568. There is a nifty util in the BFDS files called DIRCOMP:
  569.  
  570. DIRCO511.ZIP  117060 12-18-95  DIRCOMP.EXE (5.11):  Updates files in one
  571.                                subdirectory based on files in another
  572.                                subdirectory.  Similar in some ways to DOS's
  573.                                REPLACE command
  574.  
  575. Here is a batch file I use with this to maintain a portable
  576. parallel-port hard drive (Gator) as a mirror of another drive on my
  577. system.
  578.  
  579. ::UPD.BAT to compare two dirs, and kill dir2 files not in dir1 & copy
  580. ::        dir1 files to dir2 that are more recent, or not in dir2.
  581. @echo off
  582. CP /T:N,10             Do you want the Gator UpDated?
  583. if %EL% 2 goto end
  584. dirco k: l: /KILL /APPEND /-I
  585. :end
  586.  
  587. Saves me MANY hours each month, and hasn't messed up yet.  Also
  588. maintains a log of it's activities.  The second line uses Chad's Choice
  589. Plus (CP102).  Could use CHOICE or leave it out.
  590. Note:  The %EL% is a shortcut allowed by my inclusion of:
  591.  
  592. SET EL=ERRORLEVEL   ;in my AEBat file.
  593.  
  594. If your DOS includes REPLACE, you might get it to do your bidding?
  595. I also renamed the DIRCOMP.EXE so it looks like the archive name.
  596. Good Modeming!  /\oo/\
  597.  
  598. ... NetMail: 1:382/1201 or E-mail: bat.lang@1201.ima.infomail.com
  599.  
  600. -!- Blue Wave/Max v2.30
  601.  ! Origin: The HUB * Austin TX * Centex PCUG * 512-346-1852 (1:382/1201)
  602.  
  603. ─ Area: Batch Language Programming                     FI ────────────────────
  604.   Msg#: 445                                          Date: 11 Mar 96  12:47:00
  605.   From: Gottfried Hommon                             Read: Yes    Replied: No
  606.     To: STEPHAN HOPPE                                Mark:
  607.   Subj: Sloppy batch file
  608. ──────────────────────────────────────────────────────────────────────────────
  609. -----------------------------------------  Vienna, the 11.Mar.1996 at 12.46
  610.   Hi STEPHAN!
  611.  
  612. 29-Feb-96 19:35, STEPHAN HOPPE wrote to ALL
  613.           Subject: Sloppy batch file
  614.  
  615.  SH> Is there any way of making this a little less bulky?
  616.  
  617. >>>>>GETDAY.BAT
  618.  SH> @echo off
  619.  SH> REM the line below returns the day of the month as an errorlevel. . .
  620.  SH> c:\utility\1tellme.exe day
  621.  SH> if errorlevel 1 if not errorlevel 2 set Today=1
  622.  SH> if errorlevel 2 if not errorlevel 3 set Today=2
  623.  SH> .
  624.  SH> if errorlevel 31 if not errorlevel 32 set Today=31
  625.                       ^^^^^^^^^^^^^^^^^^^^
  626.                       is not necessary
  627.  
  628. do this:
  629.  
  630. for %%f in (1 2 3 4 5 6 7 8 9 10 11 12 13) do if errorlevel %%f set Today=%%f
  631. for %%f in (14 15 16 17 18 19 20 21 22 23) do if errorlevel %%f set Today=%%f
  632. for %%f in (24 25 26 27 28 29 30 31) do if errorlevel %%f set Today=%%f
  633.  
  634.  with friendly greetings
  635.  from Gottfried Hommon
  636.  
  637. -!- Terminate 1.50/Pro
  638.  ! Origin: ---------------> NOVELL DOS 7.15 USER <--------------- (2:310/65.78)
  639.  
  640. ─ Area: Batch Language Programming                     FI ────────────────────
  641.   Msg#: 435                                          Date: 12 Mar 96  05:49:03
  642.   From: Vernon Frazee                                Read: Yes    Replied: No
  643.     To: Scott Farrell                                Mark:
  644.   Subj: File_id.diz
  645. ──────────────────────────────────────────────────────────────────────────────
  646. MC> Check a zip file to see if it has a file_id.diz. if not then open
  647. MC> the editor (ide.exe) which produces a file_id.diz in its own
  648. MC> directory then this has to be inserted in the zip that was
  649. MC> checked. If the file has a file_id.diz then continue to check the
  650. MC> next zip.
  651.  
  652. SF> Have you got a solution to this?
  653.  
  654.     Stick the following simple BATch file in some directory in
  655.     your PATH.  (I keep my BATch files in "C:\BAT" for example).
  656.  
  657.       @echo off
  658.       :ZIPID.BAT
  659.        pkunzip %1 file_id.diz
  660.        if errorlevel 11 goto End
  661.        edit file_id.diz
  662.        pkzip %1 file_id.diz
  663.        del file_id.diz
  664.       :End
  665.  
  666.     Now change to the drive:\directory containing the ZIP files you
  667.     want to work on and type the command:
  668.  
  669.       for %x in (*.zip) do call zipid %x
  670.  
  671.     That's it.
  672.  
  673.     Each ZIP file in your current directory will be checked for the
  674.     presence of a FILE_ID.DIZ file.  If it exists, ZIPID.BAT file simply
  675.     exits (and then the for-in-do command above re-launches it with a
  676.     new filename.ZIP).  If a FILE_ID.DIZ didn't exist, DOS EDIT is
  677.     launched so you can create one.  When you exit EDIT, PKZIP adds your
  678.     new FILE_ID.DIZ to the filename.ZIP file just checked, your
  679.     FILE_ID.DIZ is deleted, and ZIPID.BAT exits back to DOS.  And, when
  680.     the for-in-do is done presenting all the filename.ZIPs to ZIPID.BAT,
  681.     all your ZIP files should contain a FILE_ID.DIZ.
  682.  
  683.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  684.  
  685. -!- OLMS 2.53p+ [ERSBN55C]
  686.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  687.  
  688. ─ Area: Batch Language Programming                     FI ────────────────────
  689.   Msg#: 447                                          Date: 13 Mar 96   9:49:00
  690.   From: Horst Schaeffer                              Read: Yes    Replied: No
  691.     To: Paul Emmons                                  Mark:
  692.   Subj: Scripting programs
  693. ──────────────────────────────────────────────────────────────────────────────
  694. -=> quoting Paul Emmons to All (7 Mar 96) <=-
  695.  
  696. PE> [...]
  697. PE> Could anyone describe the basic techniques or algorithms which
  698. PE> these various systems use?
  699.  
  700. -+-+- quote from Richard Marks' UUencode/UUdecode package:
  701.  
  702. The basic scheme is to break groups of 3 eight bit characters (24 bits)
  703. into 4 six bit characters and then add 32 (a space) to each six bit
  704. character which maps it into the readily transmittable character.
  705. Another way of phrasing this is to say that the encoded 6 bit
  706. characters are mapped into the set:
  707.         `!"#$%&'()*+,-./012356789:;<=>?@ABC...XYZ[\]^_
  708. for transmission over communications lines.
  709.  
  710. As some transmission mechanisms compress or remove spaces, spaces are
  711. changed into back-quote characters (a 96).  (A better scheme might be
  712. to use a bias of 33 so the space is not created, but this is not done.)
  713.  
  714. Another newer less popular encoding method, called XX-encoding uses the
  715. set:    +-01..89ABC...XYZabc...xyz
  716.  
  717. In my opinion, XX-encoding is superior to UU-encoding because it uses
  718. more "normal" characters that are less likely to get corrupted.  In
  719. fact several of the special characters in the UU set do not get thru an
  720. EBCDIC to ASCII translation correctly.
  721. -+-+- unquote
  722.  
  723. PE> 256^4 = 4.294968E+09, and 85^5 = 4.437053E+09.  Therefore, four
  724. PE> binary bytes could be encoded into five ascii characters using any
  725. PE> 85 of the ascii values between 32 and 127.  Although I haven't
  726. PE> tried implementing this in assembler, I would guess that
  727. PE> recovering the original binary file from such a script would fit
  728. PE> the architecture and instruction set of the 86 processors easily,
  729. PE> i.e. the necessary code could be given in a short enough debug
  730. PE> script header.
  731.  
  732. For a range of 85 you would need 32 bit multiplications. No big problem
  733. even for a 8086, but the DEBUG header will become a little larger.
  734. Main problem is to define a set of 85 characters that is safe enough
  735. for FIDO mails. I'm not sure which characters between 31 and 127 have
  736. to be definitely excluded to avoid problems.
  737.  
  738. PE> Probably others have thought of this principle or a better one, so
  739. PE> there is no point in re-inventing the wheel if it has been done. I
  740. PE> would like to know how Chad's and Horst's encoding systems work,
  741. PE> but the answer is not obvious from the scripts they produce.
  742.  
  743. I think everyone used the simple method of shifting 4*6 bits out of
  744. 24. The idea of using a range other than 2^n is a very interesting
  745. approach indeed.
  746.  
  747. However a ratio of 5/3 (vs. 4/3) would make scripts only 6.25% smaller
  748. (not counting the overhead), and in zipped mail packages it will
  749. probably make no difference at all.
  750. Is is worth introducing a new standard?
  751.  
  752. Horst.
  753.  
  754. ... Q4FM 2.10 ... horst@confusion.rmc.de
  755.  
  756. -!- FM 2.02 / ScanToss
  757.  ! Origin: Don't follow leaders! (2:2480/13.75)
  758.  
  759. ─ Area: Batch Language Programming                     FI ────────────────────
  760.   Msg#: 429                                          Date: 12 Mar 96  22:41:00
  761.   From: William Lipp                                 Read: Yes    Replied: No
  762.     To: Larry Nelson                                 Mark:
  763.   Subj: Sloppy Batch
  764. ──────────────────────────────────────────────────────────────────────────────
  765.  -=> Quoting Larry Nelson to William Lipp <=-
  766.  
  767.  LN> for %%q in (1 2 3) do if errorlevel %%q goto %%q
  768.  
  769.  LN> When I reversed the order of the options in For's set to
  770.  LN> (3 2 1) the result was always 1
  771.  
  772.  LN> Any body got an idea why For needs the options in asending
  773.  LN> order rather than desending?
  774.  
  775. The behavior of for-in-do with goto was a topic of discussion a few
  776. months back.  My recollection is that the loop finishes all iterations
  777. before executing any "goto" statement.  It then acts upon the
  778. last goto.
  779.  
  780.  
  781. ___ Blue Wave/QWK v2.12
  782.  
  783. -!- Maximus 3.01
  784.  ! Origin: this space available bbs (1:141/1111)
  785.  
  786. ─ Area: Batch Language Programming                     FI ────────────────────
  787.   Msg#: 424                                          Date: 13 Mar 96  20:48:00
  788.   From: Vernon Frazee                                Read: Yes    Replied: No
  789.     To: Dennis Mccunney                              Mark:
  790.   Subj: Batch Problem
  791. ──────────────────────────────────────────────────────────────────────────────
  792. DM> Are you telling 4DOS to load itself and its environment and aliases
  793. DM> into UMBs?  There are an assorment of directives settable in
  794. DM> 4DOS.INI to specify this:
  795. DM>   UMBAlias                Load global aliases in UMB
  796. DM>   UMBDirHistory           Load global directory history in UMB
  797. DM>   UMBEnvironment          Load master environment in UMB
  798. DM>   UMBHistory              Load history in UMB
  799. DM>   UMBLoad                 Load resident part of 4DOS in UMB
  800. DM> Do so, and your environment and other things 4DOS uses come out of
  801. DM> conventional memory, as does all but 256 bytes of the resident
  802. DM> portion of 4DOS itself)
  803. DM> I strongly suspect the memory values you posted above would be
  804. DM> rather different if you did this.
  805.  
  806.     As suggested I created a 4DOS.INI file containing the following:
  807.  
  808.       UMBAlias
  809.       UMBDirHistory
  810.       UMBEnvironment
  811.       UMBHistory
  812.       UMBLoad
  813.  
  814.     From "mem/c" before creating 4DOS.INI ------------------------------
  815.     Free       747,616  (730K)    635,200  (620K)
  816.  
  817.     From "mem/c" after after creating 4DOS.INI -------------------------
  818.     Free       747,616  (730K)    635,200  (620K)
  819.  
  820.     What am I doing wrong?
  821.  
  822. VF> Hmmm... With just a 360K disk, the tools I would probably grab would
  823. VF> be everything I might need to format a hard drive: DEBUG, FDISK, and
  824. VF> FORMAT (68,020 bytes); a few general tools like: CHKDSK, CHOICE,
  825. VF> EDLIN, and FIND (33439 bytes); of course GWBASIC (80,592 bytes); and
  826. VF> then my communications program {COMMO} (29,872 bytes) so I could
  827. VF> logon to any one of a multitude of systems I have access to and
  828. VF> download anything else I might need. <g>  On a MS-DOS v6.22 bootable
  829. VF> diskette that should still leave over 10,000 bytes for whatever
  830. VF> else.
  831.  
  832. DM> You don't compress the executables?
  833.  
  834.     Not usually, no.
  835.  
  836. DM> You can't do it to COMMAND.COM, but everything else will pack down
  837. DM> nicely.
  838.  
  839.     DEBUG.EXE, FORMAT.COM, and CHKDSK.EXE already come compressed
  840.     but yes, packing the others (PKLITE) reduced overall size by
  841.     almost 11%.  Good idea, thanks!
  842.  
  843.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  844.  
  845. -!- OLMS 2.53p+ [ERSBN55C]
  846.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  847.  
  848. ─ Area: Batch Language Programming                     FI ────────────────────
  849.   Msg#: 440                                          Date: 13 Mar 96  20:48:12
  850.   From: Vernon Frazee                                Read: Yes    Replied: No
  851.     To: Phi Nguyen                                   Mark:
  852.   Subj: write to start of text fi
  853. ──────────────────────────────────────────────────────────────────────────────
  854. PN>  ---------PREPEND.BTM------------------
  855. PN>  @*echo off
  856. PN>  *if %# lt 2 goto Syntax_Error
  857. PN>  *setdos /x-1
  858. Vf> [ ... 46 lines deleted ... ]
  859. PN>  ---------------------------------------
  860.  
  861.      Here's a simple example that works with DOS:
  862.  
  863.        @echo off
  864.        :PREPEND.BAT
  865.         if (%2)==() goto End
  866.         if not exist %1 goto End
  867.         set ~fn=%1
  868.         copy %~fn% ~1>nul
  869.        :Loop
  870.         shift
  871.         if (%1)==() goto Copy
  872.         if not (%~tx%)==() set ~tx=%~tx% %1
  873.         if (%~tx%)==() set ~tx=%1
  874.         goto Loop
  875.        :Copy
  876.         echo %~tx%>~2
  877.         copy ~2+~1 %~fn%>nul
  878.         for %%x in (1 2) do del ~%%x
  879.         for %%x in (fn tx) do set ~%%x=
  880.        :End
  881.  
  882.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  883.  
  884. -!- OLMS 2.53p+ [ERSBN55C]
  885.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  886.  
  887. ─ Area: Batch Language Programming                     FI ────────────────────
  888.   Msg#: 448                                          Date: 15 Mar 96  17:58:01
  889.   From: Vernon Frazee                                Read: Yes    Replied: No
  890.     To: Larry Nelson                                 Mark:
  891.   Subj: Sloppy Batch
  892. ──────────────────────────────────────────────────────────────────────────────
  893. JK> for %%a in (1 2 3 4 5 6 7 8 9..... 31) do if errorlevel %%a .....
  894. JK> (A classic .BAT improvement!)
  895.  
  896. WL> Since the errorlevel function is "errorlevel greater than or equal
  897. WL> to N", this code would execute the "if" section 31 times for a
  898. WL> "no error" return of zero.  That was probably not what you had in
  899. WL> mind.
  900.  
  901. LN> For seems to tweak the order of things. Joe's example worked fine
  902. LN> for me when I use it as in the following....
  903. LN>   ::4tst.bat/DOS62.0
  904. LN>   @echo off
  905. LN>   cls
  906. LN>        choice/cabc
  907. LN>        for %%q in (1 2 3) do if errorlevel %%q goto %%q
  908. LN>  :1
  909. LN>     echo a
  910. LN>     goto L8r
  911. LN>  :2
  912. LN>     echo b
  913. LN>     goto L8r
  914. LN>  :3
  915. LN>     echo c
  916. LN>  :L8r
  917. LN> When I reversed the order of the options in For's set to (3 2 1) the
  918. LN> result was always "a" Any body got an idea why For needs the options
  919. LN> in asending order rather than desending?
  920.  
  921.     Because DOS will process everything in between the parenthesis
  922.     before it makes it's final descision.
  923.  
  924.     For example, with (1 2 3) and you press B, DOS will do:
  925.  
  926.       if errorlevel 1 goto 1       (which proves true)
  927.       if errorlevel 2 goto 2       (which proves true)
  928.       if errorlevel 3 goto 3       (which proves not true)
  929.  
  930.     Now that it's done testing it does the last thing that proved true,
  931.     "goto 2", which is correct.
  932.  
  933.     But if you flip it around, (3 2 1), and press B, DOS will do:
  934.  
  935.       if errorlevel 3 goto 3       (which is not true)
  936.       if errorlevel 2 goto 2       (which is true)
  937.       if errorlevel 1 goto 1       (which is true)
  938.  
  939.     Now that it's done testing it does the last thing that proved true,
  940.     "goto 1", which is incorrect.
  941.  
  942.     Clear as mud yet? <G>
  943.  
  944.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  945.  
  946. -!- OLMS 2.53p+ [ERSBN55C]
  947.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  948.  
  949. ─ Area: Batch Language Programming                     FI ────────────────────
  950.   Msg#: 438                                          Date: 16 Mar 96  08:01:00
  951.   From: David Roper                                  Read: Yes    Replied: No
  952.     To: Vernon Frazee                                Mark:
  953.   Subj: BATCH PROBLEM
  954. ──────────────────────────────────────────────────────────────────────────────
  955. VF> Hmmm... With just a 360K disk, the tools I would probably grab would
  956. VF> be everything I might need to format a hard drive: DEBUG, FDISK, and
  957. VF> FORMAT (68,020 bytes); a few general tools like: CHKDSK, CHOICE,
  958. VF> EDLIN, and FIND (33439 bytes); of course GWBASIC (80,592 bytes); and
  959. VF> then my communications program {COMMO} (29,872 bytes) so I could
  960. VF> logon to any one of a multitude of systems I have access to and
  961. VF> download anything else I might need. <g>  On a MS-DOS v6.22 bootable
  962. VF> diskette that should still leave over 10,000 bytes for whatever
  963. VF> else.
  964. VF>    DEBUG.EXE, FORMAT.COM, and CHKDSK.EXE already come compressed
  965.   >    but yes, packing the others (PKLITE) reduced overall size by
  966.   >    almost 11%.  Good idea, thanks!
  967.  
  968.   Vernon, if you're trying to shrink 'em (and I have a similar disk to
  969.   yours for traveling) I used the COMTOEXE and then LZEXE so that I
  970.   didn't have to buy PKLITE.  Nothing wrong with buying PKLITE, but
  971.   for those reading this message, there's the other way "out."
  972.  
  973.          _____oOOo_/00\_oOOo_____      david.roper@mms.raleigh.nc.us
  974.      1996          \__/            201 WINDING BROOK Dr, GARNER NC 27529
  975.  
  976. -!- FLAME v1.1
  977.  ! Origin: Full Internet Access $15.00, (919) 779-6674 or MMS.NET (1:151/102)
  978.  
  979. ─ Area: Batch Language Programming                     FI ────────────────────
  980.   Msg#: 447                                          Date: 17 Mar 96  15:27:05
  981.   From: Stamatis Kantartzis                          Read: Yes    Replied: No
  982.     To: Jim Danvers                                  Mark:
  983.   Subj: Prompt
  984. ──────────────────────────────────────────────────────────────────────────────
  985. Hi Jim! What's up?
  986.  
  987. On 16-Mar-96, at 09:23:00, Jim Danvers wrote this to All about Prompt:
  988.  
  989.  JD> Hi guys... I would like to get a "spinning wheel" type
  990.  JD> prompt for command lines. IE;, a spinning | symbol... can we do
  991.  JD> this through ansi? That's all.... call me bored. <g>
  992.  
  993. Here's the latest version of SPIN.BAT:
  994.  
  995. @echo off
  996. loadbtm on
  997. setlocal
  998.  
  999. ::-----Init spinning characters
  1000. set s0=`%=|`
  1001. set s1=/
  1002. set s2=-
  1003. set s3=\
  1004.  
  1005. ::-----Init pointer to starting position
  1006. set s=0
  1007.  
  1008. :-----Save cursor
  1009. set cursor=%_CO:%_CI
  1010.  
  1011. ::-----This is for olders version of 4DOS
  1012. if "%cursor" eq ":" set cursor=10:100
  1013.  
  1014. ::-----Turn off cursor
  1015. setdos /s0:0
  1016.  
  1017. ::-----Display title
  1018. echo %=nSPIN.BAT - Phi Nguyen 03.04.96%=n
  1019. echo Press any key to quit%=n
  1020.  
  1021. ::-----Display prompt. It requires 2 trailing spaces (1 will be erased)
  1022. echos `Please wait:  `
  1023.  
  1024. do while %_kbhit eq 0
  1025.   ::-----Display spin
  1026.   ::     %=b uses to clear the previous spin char (backspace)
  1027.   ::     %[s%s] uses to show the current spin char (like *ptr in C)
  1028.   echos %=b%[s%s]
  1029.  
  1030.   ::-----Increase the pointer to next spin char. It will rotate from
  1031.   ::     0 to 3 to 0 to 3 ...
  1032.   set s=%@word[%s,1 2 3 0]
  1033.  
  1034.   ::-----Do whatever here
  1035. enddo
  1036.  
  1037. ::-----Clear prompt
  1038. echos %=r               %=r
  1039.  
  1040. ::-----Eat keypressed
  1041. inkey %%key
  1042.  
  1043. ::-----Turn on cursor
  1044. setdos /s%cursor
  1045. endlocal
  1046.  
  1047.  
  1048.              |-=-=-=> Sincerely, Stamatis Kantartzis <=-=-=-|
  1049.  
  1050. .!. Inflation means the Buck does not stop here...
  1051.  
  1052. -!- Terminate 3.00
  1053.  ! Origin:  (1:109/570.14)
  1054.  
  1055. ─ Area: Batch Language Programming                     FI ────────────────────
  1056.   Msg#: 430                                          Date: 21 Mar 96  00:16:11
  1057.   From: Paul Emmons                                  Read: Yes    Replied: No
  1058.     To: Jeff Dubois                                  Mark:
  1059.   Subj: zipping gazillions of tex
  1060. ──────────────────────────────────────────────────────────────────────────────
  1061. -> Is there a simply way, via batch, to zip up a gazillion *.TXT files
  1062. -> into individual zip files and upon completion then delete all the
  1063. -> *.TXT files in that directory?
  1064. ->
  1065. -> What I got:  A.TXT, B.TXT, C.TXT ...
  1066. -> What I want: A.ZIP, B.ZIP, C.ZIP ...
  1067. ->
  1068. -> There is an easy way.  But I don't know it. :-)
  1069.  
  1070. I think the best way is to create a subdirectory to receive the
  1071. zip files, or at least put them in a subdirectory which has no
  1072. files *.txt.  If this subdirectory is \TEM, then you need:
  1073.  
  1074. for %%f in (*.txt) do pkzip -omex \tem\%%f %%f
  1075. ren \tem\*.txt *.zip
  1076.  
  1077. The pkzip -m flag will remove the files it zips up.  The files
  1078. created by pkzip in \tem are originally named *.txt, and you
  1079. have to rename them *.zip in a separate line.
  1080. -!- FidoPCB v1.4 [ff348/b]
  1081.  ! Origin: The Bauding House (1:2626/312) 610/692-7392
  1082.  
  1083. ─ Area: Batch Language Programming                     FI ────────────────────
  1084.   Msg#: 450                                          Date: 23 Mar 96  23:45:00
  1085.   From: Gary Smith                                   Read: Yes    Replied: No
  1086.     To: Jeff Dubois                                  Mark:
  1087.   Subj: zipping gazillions of tex
  1088. ──────────────────────────────────────────────────────────────────────────────
  1089. JD> Is there a simply way, via batch, to zip up a gazillion *.TXT files into
  1090.   > individual zip files and upon completion then delete all the *.TXT files in
  1091.   > that directory?
  1092.  
  1093. JD> What I got:  A.TXT, B.TXT, C.TXT ...
  1094.   > What I want: A.ZIP, B.ZIP, C.ZIP ...
  1095.  
  1096. JD> There is an easy way.  But I don't know it. :-)
  1097.  
  1098. The following is fairly straightforward.  It assumes that you're
  1099. running it in the directory where the TXT files reside, and does
  1100. no error checking.  If you like lots of activity on the screen,
  1101. remove the two occurrences of "> nul".
  1102.  
  1103.  @echo off
  1104.  md $$temp$$
  1105.  for %%f in (*.txt) do pkzip -m $$temp$$\%%f %%f > nul
  1106.  ren $$temp$$\*.txt *.zip
  1107.  move $$temp$$\*.zip . > nul
  1108.  rd $$temp$$
  1109. -!-
  1110.  * OLX 1.53 * Veni, vidi, velcro - I came, I saw, I stuck around
  1111.  
  1112. -!- WILDMAIL!/WC v4.12
  1113.  ! Origin: The Computer Room-Pickerington, Oh  (1:226/110.0)
  1114.  
  1115. ─ Area: Batch Language Programming                     FI ────────────────────
  1116.   Msg#: 443                                          Date: 26 Mar 96  17:25:02
  1117.   From: Vernon Frazee                                Read: Yes    Replied: No
  1118.     To: Roy Reed                                     Mark:
  1119.   Subj: J. Dubois request, others complaints
  1120. ──────────────────────────────────────────────────────────────────────────────
  1121. RR> I tried a quick and dirty way to convert .txt files to .zip files
  1122. RR> per request of Mr. Dubois.  Per response of Mr. Primus, this method
  1123. RR> did not retain the .txt extension within the zipped file.  Per Mr.
  1124. RR> Frazee's response, extensionless files in the directory were not
  1125. RR> protected.  Per this response, the batch file below handles said
  1126. RR> complaints.  It's just not as cheap and dirty as original.  For Mr.
  1127. RR> Fraley, I truncated the .txt so that the pkzip command in the
  1128. RR> FOR-IN-DO would zip the file and give it the same name, which
  1129. RR> resulted in loss of extension inside the .zip file.
  1130. RR> I love doing this to get Frazee cranking - hehehehehe.
  1131.  
  1132.     Guess who?  <G>
  1133.  
  1134. RR> -!---upper extraction line-----
  1135. RR> @echo off
  1136. RR> if "%1"=="blasphemy" goto blasphemy
  1137. RR> ren *.  *.^-^
  1138. RR> ren *.txt  *.
  1139. RR> for %%x in (*.) do call %0 blasphemy %%x
  1140. RR> del *.txt
  1141. RR> ren *.^-^  *.
  1142. RR> set base=
  1143. RR> goto end
  1144. RR> :blasphemy
  1145. RR> set base=%2
  1146. RR> ren %2 %2.txt
  1147. RR> pkzip %2 %2.txt
  1148. RR> :end
  1149. RR> -!---lower extraction line-----
  1150.  
  1151.     Here, try this ZIP&DEL.BAT
  1152.  
  1153.       @echo off
  1154.       >~tmptmp~.bat mode %1
  1155.       >invalid.bat echo set ~fn~=%%3
  1156.       for %%x in (call del) do %%x ~tmptmp~.bat
  1157.       pkzip -exmo %~fn~% %1 | del invalid.bat
  1158.  
  1159.     To use it, first make sure you the above ZIP&DEL.BAT, DOS's MODE.COM
  1160.     and Phil Katz' PKZIP.EXE in your PATH (or current directory) and at
  1161.     least 18 bytes free environment space.
  1162.  
  1163.     Now go to some directory containing at least a few files with the
  1164.     same extension, for example ".TXT", and then type the command:
  1165.  
  1166.       for %x in (*.txt) do call zip&del %x
  1167.  
  1168.     That's it.  When this four-working-line "ZIP&DEL.BAT" gets done:
  1169.  
  1170.     a) all the *.TXT files will each be in their own individual
  1171.        "samename.ZIP" file
  1172.  
  1173.     b) with a date and time stamp matching the original file
  1174.  
  1175.     c) and the originals deleted.
  1176.  
  1177.     "Kewl" eh?  <G>
  1178.  
  1179.     Now give me something to "crank" on.  That may have taken the better
  1180.     part of maybe a minute to whip up using nothing more than "COPY CON"
  1181.     a-n-d it required no further editing.  <grin>
  1182.  
  1183.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1184. -!- Terminate 3.00
  1185.  ! Origin: Terminate = Pointmailer+Tosser+Reader+Packer+QWK! (1:135/71.17)
  1186.  
  1187. ─ Area: Batch Language Programming                     FI ────────────────────
  1188.   Msg#: 449                                          Date: 27 Mar 96  03:05:37
  1189.   From: Dennis Mccunney                              Read: Yes    Replied: No
  1190.     To: Otto Lang                                    Mark:
  1191.   Subj: PATH limit
  1192. ──────────────────────────────────────────────────────────────────────────────
  1193.  ** From Otto Lang to Dennis McCunney on 24 Mar 96  16:30:00
  1194.  ** Re: PATH limit
  1195.  
  1196.  DM> JC> Well, some of us STILL use only DOS. Like me. I use a menu program,
  1197.  DM> JC> but I also do things from the DOS prompt and from a File Manager
  1198.  DM> JC> program. Therefore, I have a fairly long path. Witness:
  1199.  
  1200.  DM> JC> Path C:\;C:\DOS;C:\UTIL\TV;C:\UTIL\PAK;C:\3DMENU;C:\WP60;
  1201.  DM> JC> Path %PATH%;C:\UTIL\PGP;C:\UTIL\UUCODE;C:\SOUND\UTIL\DAPLAY;
  1202.  
  1203.  DM>    I still use only DOS here, as well, but I'm at pains to keep my PATH
  1204.  DM> short.  The current one is:
  1205.  
  1206.  DM> PATH=e:\;c:\usr\batch;c:\usr\vdisk;c:\usr\bin;c:\4dos;c:\usr\lbin;c:\dos;
  1207.  DM> c:\bin;c:\dgn;..;.
  1208.  
  1209.  OL> There are two lesson I learned early: (1) Keep dir names short, e.g.
  1210.  OL> UT or UTL instead of UTIL and (2) if you SUBST U: C:\USR you can save
  1211.  OL> a lot of typing and see more of your path line in the autoexec.bat.
  1212.  OL> Just don't forget the LASTDRIVE=Z!
  1213.  
  1214.     The directory names and directory structure I use are based on those
  1215.  used by UNIX.  I learned UNIX before I really spent any time in DOS,
  1216.  and I find it simpler to make my DOS environment resemble the one I
  1217.  have under UNIX as much as possible.  (With the MKS Toolkit installed,
  1218.  that can be more than you would believe...)  I've never found SUBST
  1219.  neccessary, and I use LASTDRIVE=E:, since that IS my last drive.
  1220.  
  1221.     Seeing the long PATH isn't a big problem, since it isn't that long,
  1222.  and I'm more concerned about the number of directories in it than the
  1223.  length of the directory names.  Directories are in the PATH in the
  1224.  order of frequency of access. I keep the command processor and some
  1225.  frequently used utilities on the ramdisk, so that is first in the PATH.
  1226.  
  1227.     Saving typing is provided by other 4DOS features.  I set
  1228.  environment variables to the names of frequently used directories.
  1229.  For example, I have UB=c:\usr\bin in my environment definitions.  4DOS
  1230.  interprets variables on the command line as well as in batch files, so
  1231.  I can do "p %ub", instead of "pushd c:\usr\bin".  P is an alais for
  1232.  PUSHD, an internal command in 4DOS that pushes the current directory
  1233.  onto a stack and changes to the drive directory specified as the
  1234.  argument.  POPD (aliased to "." here) pops the saved drive/directory
  1235.  from the stack and returns me to where I was.
  1236.  
  1237.  
  1238. -!- Blue Wave/DOS v2.30
  1239.  ! Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/304)
  1240.  
  1241. ─ Area: Batch Language Programming                     FI ────────────────────
  1242.   Msg#: 445                                          Date: 27 Mar 96  16:30:48
  1243.   From: Vernon Frazee                                Read: Yes    Replied: No
  1244.     To: Roy Reed                                     Mark:
  1245.   Subj: IS THIS DIRECTORY EMPTY?
  1246. ──────────────────────────────────────────────────────────────────────────────
  1247. RR> I use dos 5 and the following works for me.  I use find to pick out
  1248. RR> the "2 files and 0 bytes" if a dir is empty.  If not, it doesn't
  1249. RR> pick out, and a zero length byte file doesn't get copied, which I
  1250. RR> check to see if it exists.  I heard 4dos copies 0 byte files.  Ta
  1251. RR> ta.
  1252.  
  1253. RR> -!--- snip line-----
  1254. RR> @echo off
  1255. RR> if "%1"=="/?" goto syntax
  1256. RR> dir %1 | find "2 file(s)          0 bytes" > ~~~4now
  1257. RR> copy ~~~4now ~~~after > nul
  1258. RR> if exist ~~~after echo directory %1 is empty
  1259. RR> if not exist ~~~after echo directory %1 contains at least one file
  1260. RR> if exist ~~~4now del ~~~4now > nul
  1261. RR> if exist ~~~after del ~~~after > nul
  1262. RR> goto end
  1263. RR> :syntax
  1264. RR> echo proper syntax is, for example, isempty c:\utils   or
  1265. RR> echo isempty c:\write\wp
  1266. RR> :end
  1267. RR> -!--- snip line-----
  1268.  
  1269.     You don't really need to use FIND and a temporary file to do the
  1270.     trick.  For example:
  1271.  
  1272.       @echo off
  1273.       :CHKDIR - Does it exist?  If so, any files?
  1274.        if (%1)==() echo Syntax: %0 [[d:]\]dirname[\dir[\dir\...]]
  1275.        if (%1)==() goto End
  1276.        if not exist %1\nul echo Directory "%1" does not exist.
  1277.        if not exist %1\nul goto End
  1278.        if not exist %1\*.* echo Directory "%1" is empty.
  1279.        if exist %1\*.* echo Directory "%1" has files.
  1280.       :End
  1281.  
  1282.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1283. -!- Terminate 3.00
  1284.  ! Origin: Get real, get better, get faster, get Terminate! (1:135/71.16)
  1285.  
  1286. ─ Area: Batch Language Programming                     FI ────────────────────
  1287.   Msg#: 448                                          Date: 27 Mar 96  09:33:30
  1288.   From: Vernon Frazee                                Read: Yes    Replied: No
  1289.     To: Tony Johnston                                Mark:
  1290.   Subj: unzip files
  1291. ──────────────────────────────────────────────────────────────────────────────
  1292. TJ> Is it possible to have abat or exe file automatically execute just
  1293. TJ> after is has been unzipped. If so how?
  1294.  
  1295.     With a ZIP file, fortunately no.  (Makes it to easy for kids to
  1296.     automatically launch something destructive).  Of course there is
  1297.     nothing stopping you from simply wrapping a BATch file around it:
  1298.  
  1299.       @echo off
  1300.       :START.BAT
  1301.        md c:\whatever
  1302.        pkunzip whatever.zip c:\whatever
  1303.        for %%x in (c: cd\whatever whatever cd\) do %%x
  1304.       :End
  1305.  
  1306.     Another alternative is to use ARJ instead of PKZIP.  For example,
  1307.     the following single ARJ command will unarchive FOOBAR.BAT from
  1308.     archive FOOBAR.ARJ and then immediately launch the FOOBAR.BAT:
  1309.  
  1310.     arj b foobar.arj foobar.bat -jqfoobar.bat
  1311.     --- - ---------- ----------    ----------
  1312.      |  |     |          |             |
  1313.      |  |     |          |             |
  1314.      |  |     |          |             `-- DOS command to execute after
  1315.      |  |     |          |                 the extraction has occurred
  1316.      |  |     |          |
  1317.      |  |     |          `-- Name of the file to extract
  1318.      |  |     |
  1319.      |  |     `-- Name of the ARJ archive to use
  1320.      |  |
  1321.      |  `-- Allow user to execute a DOS command
  1322.      |      on selected file(s) in the archive
  1323.      |
  1324.      `-- Launch ARJ.EXE
  1325.  
  1326.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1327. -!- Terminate 3.00
  1328.  ! Origin: Terminate SmartNote: Remembers & recalls everything! (1:135/71.17)
  1329.  
  1330. ─ Area: Batch Language Programming                     FI ────────────────────
  1331.   Msg#: 442                                          Date: 28 Mar 96  07:31:30
  1332.   From: Vernon Frazee                                Read: Yes    Replied: No
  1333.     To: Otto Lang                                    Mark:
  1334.   Subj: debug or share
  1335. ──────────────────────────────────────────────────────────────────────────────
  1336. OL> ... PPT insists on having SHARE.EXE loaded. I guess because of
  1337. OL> Windows' multitasking?  Anyway, as soon as I added
  1338. OL> INSTALL=C:\DOS\SHARE.EXE to my CONFIG.SYS the next boot hung on
  1339. OL> errors in the debug statement in CURRENT.[BAT]. ... Debug ... errors
  1340. OL> ... trying to load from ... <temptemp.scr.
  1341. OL> :CURRENT.BAT from Fidonet ... BATPOWER. ... Vernon Frazee 01/17/94
  1342.  
  1343.     I'm getting the same results here -- under DOS v6.22.  How about a
  1344.     newer version, GET-DT.BAT (Get Date and Time), that will not only
  1345.     work with SHARE loaded, (and/or should run fine under Windows95),
  1346.     but also sets Day in evar "DY", Month in evar "MM", Day date in evar
  1347.     "DD", Year in evar "YY", Hour in evar "HR", Minute in evar "MN", and
  1348.     Second in evar "SC"?
  1349.  
  1350.     :GET-DT.BAT - Type "GET-DT /?" (not the quotes) for help
  1351.     :Note: Do NOT put a "@echo off" at the beginning of this file!
  1352.     :Begin -------------------------------------------------------
  1353.      @if (%1)==(/?) goto Syntax
  1354.      @if (%1)==(!!) goto GetMDY
  1355.      @if (%1)==(!) prompt set dt=!! $d $t
  1356.      @if (%1)==(!) goto End
  1357.      @echo off
  1358.      for %%x in (dt dy mm dd yy hr mn sc) do set %%x=
  1359.      command /c %0 !>~tmp_01~.bat
  1360.      for %%x in (call del) do %%x ~tmp_01~.bat
  1361.      %0 %dt%
  1362.     :GetMDY ------------------------------------------------------
  1363.      set dt=
  1364.      set DY=%2
  1365.      shift|shift
  1366.      echo;;|choice /c:;%1%; "~tmp_02~ ">~tmp_01~.bat
  1367.      echo set mm=%%2%%3>>~tmp_02~.bat
  1368.      echo set dd=%%5%%6>>~tmp_02~.bat
  1369.      for %%x in (1 2) do echo shift>>~tmp_02~.bat
  1370.      echo set yy=%%8%%9>>~tmp_02~.bat
  1371.      call ~tmp_01~.bat
  1372.     :GetHMS ------------------------------------------------------
  1373.      echo;;|choice /c:;%2%; "~tmp_02~ ">~tmp_01~.bat
  1374.      echo if (%%3)==(:) goto Insert0>~tmp_02~.bat
  1375.      echo set hr=%%2%%3>>~tmp_02~.bat
  1376.      echo set mn=%%5%%6>>~tmp_02~.bat
  1377.      echo set sc=%%8%%9>>~tmp_02~.bat
  1378.      echo goto End>>~tmp_02~.bat
  1379.      echo :Insert0>>~tmp_02~.bat
  1380.      echo set hr=0%%2>>~tmp_02~.bat
  1381.      echo set mn=%%4%%5>>~tmp_02~.bat
  1382.      echo set sc=%%7%%8>>~tmp_02~.bat
  1383.      echo :End>>~tmp_02~.bat
  1384.      for %%x in (call del) do %%x ~tmp_01~.bat
  1385.      del ~tmp_02~.bat
  1386.     :************************************************************:
  1387.     : To display results, change the next line to "goto Display" :
  1388.     :************************************************************:
  1389.      goto End
  1390.     :Syntax ------------------------------------------------------
  1391.      @echo off
  1392.      cls
  1393.      echo     Name: GET-DT.BAT - Get current system Date and Time
  1394.      echo.
  1395.      echo   Author: Vernon Frazee 06/14/94 - (Last mod: 03/28/96)
  1396.      echo.
  1397.      echo  Purpose: Store the current system:
  1398.      echo.
  1399.      echo                Day in evar "DY" (example: DY=Tue)
  1400.      echo              Month in evar "MM" (example: MM=05 )
  1401.      echo           Day date in evar "DD" (example: DD=31 )
  1402.      echo               Year in evar "YY" (example: YY=94 )
  1403.      echo               Hour in evar "HR" (example: HR=06 )
  1404.      echo             Minute in evar "MN" (example: MN=22 )
  1405.      echo             Second in evar "SC" (example: SC=00 )
  1406.      echo.
  1407.      echo   Syntax: [call] [d:[\path]]GET-DT [/?]
  1408.      echo.
  1409.      echo    Where: /? displays this help screen
  1410.      echo.
  1411.      echo Requires: DOS's COMMAND.COM and CHOICE.COM (somewhere in
  1412.      echo           the PATH is fine), and 43 bytes of free space
  1413.      echo           in the environment.
  1414.      echo.
  1415.      echo     Note: "evar" is short for "environment variable".
  1416.      echo.
  1417.      goto End
  1418.     :Display -----------------------------------------------------
  1419.      echo DY=%dy% MM=%mm% DD=%dd% YY=%yy% HR=%hr% MN=%mn% SC=%sc%
  1420.     :End --------------------------------------------------- -vjf-
  1421.  
  1422.     (Note: I would normally test this under Windows95 first for you,
  1423.     but, at the moment I'm at the beach waiting for breakfast to arrive
  1424.     and tapping away on this DOSv6.22/WFWGv3.11 based Laptop. <g>)
  1425.  
  1426.     ./~ She wore an itsy bitsy teeny weeny yellow polka-dot bikini.. ./~
  1427.  
  1428.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1429. -!- Terminate 3.00
  1430.  ! Origin: The NEW Terminate will -=> FAX <=- almost anything! (1:135/71.17)
  1431.  
  1432. ─ Area: Batch Language Programming                     FI ────────────────────
  1433.   Msg#: 445                                          Date: 28 Mar 96  06:07:54
  1434.   From: Vernon Frazee                                Read: Yes    Replied: No
  1435.     To: Josef Schwartz                               Mark:
  1436.   Subj: how do I...
  1437. ──────────────────────────────────────────────────────────────────────────────
  1438. VF> The following ANSI escape sequence sets the [UpArrow] so it acts
  1439. VF> like a press of the [Enter] key: <-[0;72;"";13p
  1440.   > [snip]
  1441.  
  1442. JS> What would I have to do to switch the ";"  with the ":" ?
  1443.  
  1444.     I used to do that too, years ago, and still have customers
  1445.     occasionally requesting the same.  All it really takes is a couple
  1446.     of escape sequences, (much like the one above), but, instead of
  1447.     trying to explain how to do ANSI escape sequences, I've simply been
  1448.     giving them the enclosed SEMISWAP.BAT along with the following
  1449.  
  1450.     SEMISWAP.BAT Instructions:
  1451.  
  1452.     1) Place a copy of the enclosed SEMISWAP.BAT in a directory in your
  1453.        PATH. (For example, in "C:\BAT").
  1454.  
  1455.     2) Make sure your CONFIG.SYS file has something similar to the
  1456.        following line in it:   DEVICE=C:\DOS\ANSI.SYS
  1457.  
  1458.     3) Insert the following line near the beginning of your AUTOEXEC.BAT
  1459.        file:   CALL C:\BAT\SEMISWAP.BAT /ON
  1460.  
  1461.     4) Reboot and get to the DOS prompt.
  1462.  
  1463.     5) Type "SEMISWAP" (not the quotes) and the current status should be
  1464.        "SEMISWAP=On".  If it is, your ";" and ":" keys should now be
  1465.        swapped.  If not, start back at "1)", making sure sure each and
  1466.        every character is correct and that the "drive:\path\" on each
  1467.        line actually points to the respective file.  (In other words,
  1468.        does the ANSI.SYS file actually exist in directory C:\DOS?; etc.)
  1469.  
  1470. ------------------------------> Cut Here <------------------------------
  1471. @echo off
  1472. :SEMISWAP.BAT - Swaps the ":" and ";" keys, or resets to normal.
  1473.  goto ParmCheck
  1474. :Syntax ----------------------------------------------------------------
  1475.  cls
  1476.  echo     Name: SEMISWAP.BAT (Vernon Frazee 03/11/84, Last Mod 03/28/96)
  1477.  echo.
  1478.  echo  Purpose: Swaps the semi-colon ";" and the colon ":" keys.
  1479.  echo.
  1480.  echo           "/On" = Swapped and "/Off" = Normal
  1481.  echo.
  1482.  echo           In other words, when On or swapped:
  1483.  echo.
  1484.  echo           a) simply pressing the [;] key will now produce the ":"
  1485.  echo              character (instead of having to hold down the [Shift]
  1486.  echo              key and pressing the [;] key to get it).
  1487.  echo.
  1488.  echo           b) and to get the ";" character, you will now have to
  1489.  echo              hold down the [Shift] key and press [;].
  1490.  echo.
  1491.  echo   Syntax: [call] [d:][\path]SEMISWAP [/On (or) /Off (or) /?]
  1492.  echo.
  1493.  echo           SEMISWAP                  - Display current status
  1494.  echo           SEMISWAP /On              - Swap ":" with ";"
  1495.  echo           SEMISWAP /Off             - Return ":" and ";" to normal
  1496.  echo           SEMISWAP /?               - Display this screen
  1497.  echo.
  1498.  echo Requires: DOS' ANSI.SYS (or equivalent) and up to 13 bytes of free
  1499.  echo           environment space.  (Evar SEMISWAP=On or SEMISWAP=Off).
  1500.  goto End
  1501. :ParmCheck -------------------------------------------------------------
  1502.  if (%1)==() goto Display
  1503.  if (%1)==(?) goto Syntax
  1504.  if (%1)==(/?) goto Syntax
  1505.  for %%x in (on On ON oN) do if (%1)==(/%%x) goto On
  1506.  for %%x in (off Off OFf OFF oFF ofF) do if (%1)==(/%%x) goto Off
  1507.  goto Syntax
  1508. :Display status --------------------------------------------------------
  1509.  if (%SEMISWAP%)==() set SEMISWAP=Off
  1510.  echo SEMISWAP=%semiswap%
  1511.  goto End
  1512. :On (Swap the ";" and ":" keys) ----------------------------------------
  1513.  echo  [58;59p [59;58p [1A
  1514.  rem  `-------`-------`------- Three [Esc] characters (Alt-27's)
  1515.  set SEMISWAP=On
  1516.  goto Display
  1517. :Off (Unswap the ";" and ":" keys (back to normal)) --------------------
  1518.  echo  [58;58p [59;59p [1A
  1519.  rem  `-------`-------`------- Three [Esc] characters (Alt-27's)
  1520.  set SEMISWAP=Off
  1521.  goto Display
  1522. :End ------------------------------------------------------------- -vjf-
  1523. ------------------------------> Cut Here <------------------------------
  1524.  
  1525.     6) To view SEMISWAP's brief instructions type:   SEMISWAP /?
  1526.  
  1527.     That's it.  Enjoy!
  1528.  
  1529.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1530. -!- Terminate 3.00
  1531.  ! Origin: The NEW Terminate will -=> FAX <=- almost anything! (1:135/71.17)
  1532.  
  1533. ─ Area: Batch Language Programming                     FI ────────────────────
  1534.   Msg#: 431             Rec'd                        Date: 01 Apr 96  08:24:39
  1535.   From: Vernon Frazee                                Read: Yes    Replied: No
  1536.     To: Bat Lang                                     Mark:
  1537.   Subj: Echoing redirection chara
  1538. ──────────────────────────────────────────────────────────────────────────────
  1539. VF> Change to the directory containing your SCRipt files and create
  1540. VF> the following 1-line "X.BAT":
  1541. VF>   @debug<%1
  1542. VF> Now type the command:
  1543. VF>   for %x in (*.scr) do call x %x
  1544. VF> and all the SCRipt files in the current directory will be
  1545. VF> processed by DEBUG.
  1546.  
  1547. BL> Vernon, would appreciate a short {^; synopsis that would teach us
  1548. BL> all, the set of circumstances that lead to deciding: when it's
  1549. BL> better/best to use the FOR...IN...DO from the command line, rather
  1550. BL> than including it within a batch file.
  1551. BL> I'm sure we will all be grateful for this poop!  Thanks, and Good
  1552. BL> Modeming!  /\oo/\
  1553.  
  1554.     Hmmm... If it's something that will be used repetitively, I
  1555.     usually wrap a BATch file around it.  For instance, the above
  1556.     might be _quickly_ thrown together as:
  1557.  
  1558.       @echo off
  1559.       :DEBUG'EM.BAT
  1560.        if (%2)==(~!~) goto DoIt
  1561.        for %%x in (*.scr) do call %0 %%x ~!~
  1562.       :DoIt
  1563.        if (%1)==() goto End
  1564.        echo %1
  1565.        debug<%1>nul
  1566.       :End
  1567.  
  1568.     The short solution I gave above must have been because it appeared
  1569.     that the user posing the question needed to do the task but once.
  1570.  
  1571.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1572. -!- Terminate 3.00
  1573.  ! Origin: Have you ever been TERMINATEd ? (1:135/71.17)
  1574.  
  1575. ─ Area: Batch Language Programming                     FI ────────────────────
  1576.   Msg#: 425                                          Date: 01 Apr 96  16:51:00
  1577.   From: TYRIN PRICE                                  Read: Yes    Replied: No
  1578.     To: INGRID DEKKER                                Mark:
  1579.   Subj: CHOICE
  1580. ──────────────────────────────────────────────────────────────────────────────
  1581. Hi Ingrid!
  1582.  
  1583. ID>Can someone tell me how to use the CHOICE command for more than two options
  1584.  
  1585. ID>list the options right behind the number (ie: 1  start anyprogram) without
  1586. ID>getting the [Y/N] returned from DOS? Or is it enought to just echo the opti
  1587.  
  1588. ID>and set errorlevels without CHOICE?
  1589.  
  1590. CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]
  1591.  
  1592. /C[:]choices Specifies allowable keys. Default is YN
  1593. /N           Do not display choices and ? at end of prompt string.
  1594. /S           Treat choice keys as case sensitive.
  1595. /T[:]c,nn    Default choice to c after nn seconds
  1596. text         Prompt string to display
  1597.  
  1598. ERRORLEVEL is set to offset of key user presses in choices.
  1599.  
  1600. You could TYPE a text file to the screen or ECHO a menu to the screen
  1601. like this...
  1602.  
  1603. ECHO 1) Word Processor
  1604. ECHO 2) Database
  1605. ECHO 3) Spreadsheet
  1606. ECHO 4) Telecommunications
  1607.  
  1608. And then use CHOICE like this
  1609.  
  1610. CHOICE /C1234 /N What'll It Be?
  1611. IF ERRORLEVEL 4 TELIX
  1612. IF ERRORLEVEL 3 LOTUS
  1613. IF ERRORLEVEL 2 DBASE
  1614. IF ERRORLEVEL 1 WP
  1615.  
  1616. -=Ty=-
  1617.  
  1618.  * SLMR 2.1a * BREKFAST.COM halted: cereal port not found.
  1619.  
  1620. -!- GOMail v2.0 [94-0021]
  1621.  ! Origin: The Home of Aunt Gabby (1:123/17)
  1622.  
  1623. ─ Area: Batch Language Programming                     FI ────────────────────
  1624.   Msg#: 444                                          Date: 01 Apr 96  16:33:00
  1625.   From: Roy Reed                                     Read: Yes    Replied: No
  1626.     To: Robert Morton                                Mark:
  1627.   Subj: Unique filenames
  1628. ──────────────────────────────────────────────────────────────────────────────
  1629. I took a beautiful batch file by Vernon Frazee and butchered it to
  1630. get into envars the last digit of the year, one hex letter/number for
  1631. the month, two digits for the day, and the total seconds from the
  1632. current hour, minute and seconds plus offsetting it in an envar called
  1633. addxx.  I didn't go to the extent of saving the filename-base in an
  1634. envar from %1 for you.  Type set to see all.  I now know three tips
  1635. of Frazee's seven million.  Used them here.  Never catch that hummer.
  1636. Just run it to see the stuff in the environment.  You'll need
  1637. CHANGE.COM,
  1638. CHOICE, GWBASIC, and CHANGE.COM.
  1639. ---------------- snip ------------------
  1640.     :MORTON.BAT - Type "MORTON /?" (not the quotes) for help
  1641.     :Note: Do NOT put a "@echo off" at the beginning of this file!
  1642.     :Begin -------------------------------------------------------
  1643.      @if (%1)==(/?) goto Syntax
  1644.      @if (%1)==(!!) goto GetMDY
  1645.      @if (%1)==(!) prompt set dt=!! $d $t
  1646.      @if (%1)==(!) goto plum
  1647.      @echo off
  1648.      for %%x in (dt dy mm dd yy hr mn sc) do set %%x=
  1649.      command /c %0 !>~tmp_01~.bat
  1650.      for %%x in (call del) do %%x ~tmp_01~.bat
  1651.      %0 %dt%
  1652.     :GetMDY ------------------------------------------------------
  1653.      set dt=
  1654.      set DY=%2
  1655.      shift|shift
  1656.      echo;;|choice /c:;%1%; "~tmp_02~ ">~tmp_01~.bat
  1657.      echo set mm=%%2%%3>>~tmp_02~.bat
  1658.      echo set dd=%%5%%6>>~tmp_02~.bat
  1659.      for %%x in (1 2) do echo shift>>~tmp_02~.bat
  1660.      echo set yy=%%9>>~tmp_02~.bat
  1661.      call ~tmp_01~.bat
  1662.     :GetHMS ------------------------------------------------------
  1663.      echo;;|choice /c:;%2%; "~tmp_02~ ">~tmp_01~.bat
  1664.      echo if (%%3)==(:) goto Insert0>~tmp_02~.bat
  1665.      echo set hr=%%2%%3>>~tmp_02~.bat
  1666.      echo set mn=%%5%%6>>~tmp_02~.bat
  1667.      echo set sc=%%8%%9>>~tmp_02~.bat
  1668.      echo goto End>>~tmp_02~.bat
  1669.      echo :Insert0>>~tmp_02~.bat
  1670.      echo set hr=0%%2>>~tmp_02~.bat
  1671.      echo set mn=%%4%%5>>~tmp_02~.bat
  1672.      echo set sc=%%7%%8>>~tmp_02~.bat
  1673.      echo :End>>~tmp_02~.bat
  1674.      for %%x in (call del) do %%x ~tmp_01~.bat
  1675.      del ~tmp_02~.bat
  1676.     :************************************************************:
  1677.     : To display results, change the next line to "goto Display" :
  1678.     :************************************************************:
  1679.      goto End
  1680.     :Syntax ------------------------------------------------------
  1681.      @echo off
  1682.      echo Requires: DOS's COMMAND.COM, CHOICE.COM & CHANGE.COM
  1683.      echo & GWBASIC (somewhere in the PATH is fine)
  1684.      echo.
  1685.      goto plum
  1686.     :Display -----------------------------------------------------
  1687.      echo MM=%mm%=month in hex SS=%ss%=total seconds in time
  1688.      echo (hour,min,sec) YY=%yy%=1 digit for year
  1689.     :End --------------------------------------------------- -vjf-
  1690.     echo ? (%hr%*3600)+(%mn%*60)+(%sc%):system|gwbasic > ~~temp~~.bat
  1691.     echo h$=hex$(%mm%):? h$:system|gwbasic >> ~~temp~~.bat
  1692.     call change.com ~~temp~~.bat 13,10 32
  1693.     for %%x in (dy hr mn sc) do set %%x=
  1694.     call change.com ~~temp~~.bat 79,107,255 "~~^~~"
  1695.     echo set ss=%%3>~~^~~.bat
  1696.     echo set mm=%%8>>~~^~~.bat
  1697.     call ~~temp~~
  1698.     del ~~temp~~.bat
  1699.     del ~~^~~.bat
  1700.     set ymds=%YY%%MM%%DD%%SS%
  1701.     echo;;|choice /c:;%ymds%; "~~~~~ ">~~~~.bat
  1702.     call change ~~~~.bat 91,59,44 ""
  1703.     echo set addxx=%%1%%2%%3%%4%%5%%6%%7%%8.%%9>~~~~~.bat
  1704.     call ~~~~.bat
  1705.     for %%y in (~~~~~ ~~~~) do del %%y.bat
  1706.     :plum
  1707. ---------------- snip ------------------
  1708. You'll have to null out the envars later yourself.
  1709. L8tr.
  1710.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  1711.  
  1712. ─ Area: Batch Language Programming                     FI ────────────────────
  1713.   Msg#: 446                                          Date: 28 Mar 96  21:25:29
  1714.   From: Tony Baechler                                Read: Yes    Replied: No
  1715.     To: Jeff Dubois                                  Mark:
  1716.   Subj: zipping gazillions of text files
  1717. ──────────────────────────────────────────────────────────────────────────────
  1718. |Quoting Jeff to All on 18 Mar 96  23:55:18.|
  1719.  
  1720.  JD> Is there a simply way, via batch, to zip up a gazillion *.TXT files
  1721.  JD> into individual zip files and upon completion then delete all the
  1722.  JD> *.TXT files in that directory?
  1723.  
  1724. I recently discovered a util by Horst in HORST_2.ZIP called LISTMOD.
  1725. COM which sounds like it might work.  You will have to play around
  1726. with this a little, but I think something like this might work.
  1727. @ECHO OFF
  1728. DIR /B|LISTMOD /S. PKZIP $01 $01.$02 >OUT.BAT
  1729. CALL OUT.BAT
  1730.  
  1731. I am sure the following is not quite right, so experimentation is in
  1732. order here.  HORST_2 was sent into BFDS.
  1733. Mail: 1:202/1333 or baechler@crl.com, ftp://ftp.crl.com/users/ba/baechler
  1734.  
  1735. ... Is that your Tagline or did your mail reader throw up?
  1736. -!- Blue Wave/DOS v2.30
  1737.  ! Origin: Total Control BBS (ltd. hours) (1:202/1333)
  1738.  
  1739. ─ Area: Batch Language Programming                     FI ────────────────────
  1740.   Msg#: 447                                          Date: 03 Apr 96  09:12:23
  1741.   From: Vernon Frazee                                Read: Yes    Replied: No
  1742.     To: Bob Morton                                   Mark:
  1743.   Subj: JULIAN DATE 2 ENV
  1744. ──────────────────────────────────────────────────────────────────────────────
  1745. BM> Does anyone have a batch segment that will read today's date and
  1746. BM> convert it to Julian format?
  1747. BM> Actually, I need to build up a filename that is guaranteed to be
  1748. BM> unique every time it is created.  I need to use two characters out
  1749. BM> of the 8.3 format for another purpose, so I have 8.1 left for use.
  1750. BM> I was thinking of YJJJHHMM.SSXX   where XX are the two characters I
  1751. BM> need to use, but as you can see, that's still one character too
  1752. BM> long.  How about converting HHMMSS into relative seconds--a number
  1753. BM> from 1 to 86400?   Hmmmmm..that would do it: changes 6 characters
  1754. BM> (HHMMSS) into 5 digits--YJJJSSSS.SXX
  1755. BM> Guess I'd better not do this arithmetic in batch unless one of the
  1756. BM> frequently mentioned utilities will do it.
  1757.  
  1758.     How about doing it like this:
  1759.  
  1760.     The 1st digit of the filename.  Like you said, use 1 digit for the
  1761.     year -- the last digit.  For example, this is 1996 so it would be a
  1762.     "6". (Of course this means that a decade from now a filename could
  1763.     get overwritten <g>.  I'll come back to this in a sec.).
  1764.  
  1765.     The 2nd digit of the filename.  Use 1 digit for the month -- "1"
  1766.     thru "9" for Jan thru Sep, and then an "A", "B", and "C", for Oct,
  1767.     Nov, and Dec respectively.
  1768.  
  1769.     The 3rd digit of the filename.  Use 1 digit for the day -- "1" thru
  1770.     "9" for the 1st thru the 9th, and then an "A" for the 10th, "B" for
  1771.     the 11th, "C" for the 12th etc. on up thru a "U" for the 31st day of
  1772.     the month.
  1773.  
  1774.     So far then, out of your "8.1" or "9 total digit" specification, we
  1775.     have only used up three digits that cover the Year, Month, and Day.
  1776.     That means we still have 6 digits for the hours, minutes, and
  1777.     seconds.  And, since the hours minutes and seconds are always no
  1778.     more than two digits each, we can now simply use them without having
  1779.     to convert a thing.
  1780.  
  1781.     For example, right now it is   |  And for an example shows what
  1782.     04/03/96 09:39:09 which means  |  happens when the month and day
  1783.     the filename would be:         |  get up into the alphabetical
  1784.                                    |  chars., on 12/31/96 at 23:59:45
  1785.                                    |  the filename would be:
  1786.                                    |
  1787.       64309390.9                   |    6CU23594.5
  1788.       |||||||| |                   |    |||||||| |
  1789.       |||||||` `- Seconds          |    |||||||` `- Seconds
  1790.       |||||``---- Minutes          |    |||||``---- Minutes
  1791.       |||``------ Hours            |    |||``------ Hours
  1792.       ||`-------- Day              |    ||`-------- Day
  1793.       |`--------- Month            |    |`--------- Month
  1794.       `---------- Year             |    `---------- Year
  1795.  
  1796.     (BTW, since "A", "B", "C" etc. come after "1", "2", "3" etc. when
  1797.     sorted alphabetically, a sorted DIRectory listing will have the
  1798.     filenames in sorted by date/time order).
  1799.  
  1800.     Now back to the 10 year thing.  In exactly 10 years from say
  1801.     "12/31/96 at 23:59:45" it would be
  1802.     "12/31/06 at 23:59:45" which, as you can see means that using
  1803.     this approach will result with two identical filenames.  This
  1804.     probably won't be a problem however since most won't keep data
  1805.     files for a decade.  But, if so, one could simply create another
  1806.     subdirectory to keep them in.  Say for instance: C:\1990'S,
  1807.     C:\2000'S, C:\2010'S etc. or C:\1996, C:\1997, . . . whatever).
  1808.  
  1809.     If this approach sounds workable, here's a BATch file that uses
  1810.     QBASIC to create the 8.1 portion of your filename and then sticks it
  1811.     in an environment variable for you -- (so you can then tack on
  1812.     whatever last two digits you want with your BATch file).
  1813.  
  1814.     @echo off
  1815.     :-----------------------------------------------------------------
  1816.     :G9DFN.BAT - Generates a unique 9-Digit left justified 8.1 format
  1817.     :            FileName based on current system date & time.
  1818.     :  Requires: QBASIC (in PATH) and 16 bytes free environment space.
  1819.     :-----------------------------------------------------------------
  1820.      set G9DFN=
  1821.      echo DIM wn(30):FOR x=1 TO 30:READ wn(x):NEXT x>~tmp~.bas
  1822.      echo DATA 49,50,51,52,53,54,55,56,57,65,66,67,68,69,70>>~tmp~.bas
  1823.      echo DATA 71,72,73,74,75,76,77,78,79,80,81,82,83,84,85>>~tmp~.bas
  1824.      echo yy=VAL(MID$(DATE$,10,1)):mm=VAL(MID$(DATE$,1,2))>>~tmp~.bas
  1825.      echo dd=VAL(MID$(DATE$,4,2)):hr$=MID$(TIME$,1,2)>>~tmp~.bas
  1826.      echo mn$=MID$(TIME$,4,2):sc1$=MID$(TIME$,7,1)>>~tmp~.bas
  1827.      echo sc2$=MID$(TIME$,8,1)>>~tmp~.bas
  1828.      echo OPEN "~tmp~.bat" FOR OUTPUT AS #1>>~tmp~.bas
  1829.      echo PRINT #1,"set G9DFN=";CHR$(wn(yy));CHR$(wn(mm));>>~tmp~.bas
  1830.      echo PRINT #1,CHR$(wn(dd));hr$;mn$;sc1$;".";sc2$>>~tmp~.bas
  1831.      echo CLOSE:SYSTEM>>~tmp~.bas
  1832.      qbasic /run ~tmp~.bas
  1833.      del ~tmp~.bas
  1834.      for %%x in (call del) do %%x ~tmp~.bat
  1835.      echo G9DFN=%G9DFN%
  1836.     :End ------------------------------------------------------- -vjf-
  1837.  
  1838.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  1839. -!- Terminate 3.00
  1840.  ! Origin: Terminate is now specially built for Internet! (1:135/71.17)
  1841.  
  1842. ─ Area: Batch Language Programming                     FI ────────────────────
  1843.   Msg#: 445                                          Date: 04 Apr 96  11:26:51
  1844.   From: Vernon Frazee                                Read: Yes    Replied: No
  1845.     To: Jeff Cole                                    Mark:
  1846.   Subj: Need help with a BAT program
  1847. ──────────────────────────────────────────────────────────────────────────────
  1848. JC> I regularly decode UUENCODED graphics files from an fidoecho. After
  1849. JC> saving the UUCODE posts, I drop to DOS decode the file, and then run
  1850. JC> my graphics program to see what it looks like. My question is, how
  1851. JC> can I call my graphics program and then return to the directory I
  1852. JC> called it from? My guess is something like this:
  1853. JC>   cd < curdir
  1854. JC>   cd c:\graphics\gds
  1855. JC>   gds.exe
  1856. JC>   cd %curdir%
  1857. JC> Would that work?
  1858.  
  1859.     Unfortunately no, but, it really isn't much more complicated than
  1860.     that.  Here, try it like this:
  1861.  
  1862.       @echo off
  1863.       :GDS.BAT - Loads GDS and returns to current dir
  1864.       :Save current drive:\dir -----------------------
  1865.        echo @prompt cd $p$_$n:>%temp%\~tmp~.bat
  1866.        %comspec% /c %temp%\~tmp~.bat>%temp%\return.bat
  1867.        del %temp%\~tmp~.bat
  1868.       :Load GDS --------------------------------------
  1869.        for %%x in (c: cd\graphics\gds) do %%x
  1870.        gds.exe %1 %2 %3 %4 %5 %67 %7 %8 %9
  1871.       :Return to saved drive:\dir --------------------
  1872.        for %%x in (call del) do %%x %temp%\return.bat
  1873.       :End -------------------------------------------
  1874.  
  1875.     Note: The five lines beginning with ":" can be removed if you like.
  1876.  
  1877.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  1878. -!- Terminate 3.00
  1879.  ! Origin: Terminate is now specially built for Internet! (1:135/71.17)
  1880.  
  1881. ─ Area: Batch Language Programming                     FI ────────────────────
  1882.   Msg#: 422                                          Date: 04 Apr 96  22:37:05
  1883.   From: James Hill                                   Read: Yes    Replied: No
  1884.     To: MIKE DUTTERA                                 Mark:
  1885.   Subj: Get date?
  1886. ──────────────────────────────────────────────────────────────────────────────
  1887. In a msg on <Mar 05 09:45>, MIKE DUTTERA of 1:270/616 writes:
  1888.  
  1889. SH>>What I'd like to do is have a plain vanilla batch file that
  1890. SH>>grabs the day of the month so that on the 3rd, for example, I
  1891. SH>>could defrag my HD, on the 4th run scandisk, etc. etc.
  1892.  
  1893. SH>>I figure it would have to be something that grabs the day of
  1894. SH>>the month as an env variable then the calling batch files
  1895. SH>>would check this to see if its the right day.
  1896.  
  1897.  MD> Piece 'o cake. Just use MS-DOS's DATE and FIND functions in a
  1898.  MD> batch using the general form:
  1899.  
  1900.  MD> DATE|FIND "-03-"
  1901.  MD> IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 GOTO BLAHBLAH
  1902.  
  1903. or you could have done;
  1904.  
  1905. echo.|date|find "-03-"|if not errorlevel 1 defrag c: /f /h /sn
  1906. echo.|date|find "-04-"|if not errorlevel 1 scandisk c: /autofix
  1907.  
  1908. enjoy.
  1909.  
  1910. -!- msgedsq 2.1
  1911.  ! Origin: Selective On-Line (tm) - Santa Fe, NM - (505) 473-9765 - (1:15/11)
  1912.  
  1913. ─ Area: Batch Language Programming                     FI ────────────────────
  1914.   Msg#: 424                                          Date: 25 Mar 96  19:04:40
  1915.   From: Michael Marquart                             Read: Yes    Replied: No
  1916.     To: Paul Laufer                                  Mark:
  1917.   Subj: Strip .EXT from command line
  1918. ──────────────────────────────────────────────────────────────────────────────
  1919.  ~~ Paul Laufer said to All ~~
  1920.  ~~ Regarding Strip .EXT from command line ~~
  1921.  ~~ on 17 Mar 96  22:27:58 ~~
  1922.  
  1923.  Hi Paul!
  1924.  
  1925.  PL> TESTBAT.BAT C:\PATH\FILE.EXT
  1926.  
  1927.  PL> ...I would like this batch file to know that this is an (EXT) file
  1928.  PL> and "GOTO EXT".  Then I could process the file as a .EXT file.
  1929.  PL> If it's a .ZIP file it would "GOTO ZIP" in the batch process and
  1930.  PL> I could process it as a .ZIP file.
  1931.  
  1932.  Try this: tested on MSDOS V6.22 and uses only command.com.
  1933.  
  1934.  :: Call_me_what_you_will.bat ===========================================
  1935.  @echo off
  1936.  set exten=%1
  1937.  :nextchar
  1938.  set prev=%exten%
  1939.  for %%f in (/%exten%) do set exten=%%f
  1940.  if ".%exten%"=="%prev%" goto extfound
  1941.  if not "%exten%"=="%prev%" goto nextchar
  1942.  echo There was no extension given on the command line for the filename!
  1943.  goto end
  1944.  
  1945.  :extfound
  1946.  echo Extension is %prev%
  1947.  for %%f in (/%prev%) do set ext=%%f
  1948.  echo going to label %ext%
  1949.  goto %ext%
  1950.  
  1951.  :bat
  1952.  echo :bat
  1953.  goto end
  1954.  
  1955.  :com
  1956.  echo :com
  1957.  goto end
  1958.  
  1959.  :exe
  1960.  echo :exe
  1961.  goto end
  1962.  
  1963.  :txt
  1964.  echo :txt
  1965.  goto end
  1966.  
  1967.  :end
  1968.  for %%f in (ext prev exten) do set %%f=
  1969.  ::======================================================================
  1970.  
  1971.  The method was ripped off err... borrowed from one of the good denizens of
  1972.  this echo!
  1973.  
  1974.  Regards
  1975.                Mic
  1976.  
  1977.  
  1978. ... Clowns to the left of me, jokers to the right...
  1979. -!-
  1980.  ! Origin: Melbourne PC User Group  +61-3-9699-6788 (3:632/309)
  1981.  
  1982. ─ Area: Batch Language Programming                     FI ────────────────────
  1983.   Msg#: 445                                          Date: 07 Apr 96  06:43:35
  1984.   From: Vernon Frazee                                Read: Yes    Replied: No
  1985.     To: Osgar Schaedtler                             Mark:
  1986.   Subj: FIND, DELETE and FC
  1987. ──────────────────────────────────────────────────────────────────────────────
  1988. OS> I've made a file, named FILE1.TXT, made with the command:
  1989. OS>   DIR /B /A-D >FILE1.TXT
  1990. OS> Now I want to make a program that will do the following thing:
  1991. OS> The files in that directory have to be compared with the file
  1992. OS> FILE1.TXT. If there are some different files between the files in
  1993. OS> the directory and the files in FILE1.TXT, then I want to delete
  1994. OS> these files out of the directory.  Has somebody an idea?  I've
  1995. OS> tried something with the commands FIND and FC, but that didn't
  1996. OS> work. So, help me please!
  1997.  
  1998.     There is an easier way.  All it takes is one "for in do" command.
  1999.  
  2000.     Let's say you have two directories.  One named MASTER containing the
  2001.     files you want to compare to, and another named FOOBAR that contains
  2002.     a few files that are named the same as well as some extra junk files
  2003.     that you want to get rid of.  For example:
  2004.  
  2005.     =================================+==================================
  2006.     Directory of C:\MASTER           | Directory of C:\FOOBAR
  2007.                                      |
  2008.     1    TXT       0 04-07-96   6:45a| 1    TXT       0 04-07-96   6:45a
  2009.     2    TXT       0 04-07-96   6:45a| 2    TXT       0 04-07-96   6:45a
  2010.     3    TXT       0 04-07-96   6:45a| 3    TXT       0 04-07-96   6:45a
  2011.                                      | 4    TXT       0 04-07-96   6:45a
  2012.                                      | 5    TXT       0 04-07-96   6:45a
  2013.     =================================+==================================
  2014.  
  2015.     (IOW, we want to get rid of "4.TXT" and "5.TXT" in C:\FOOBAR).
  2016.  
  2017.     All it takes to do this is one DEL command.
  2018.  
  2019.     First change to the directory that contains the files you want to
  2020.     get rid of -- which in our example here is C:\FOOBAR.  Now type the
  2021.     following command at the DOS prompt:
  2022.  
  2023. -->   for %x in (*.*) do if not exist c:\master\%x del %x
  2024.  
  2025.     And that's it, you'll now have:
  2026.  
  2027.     =================================+==================================
  2028.     Directory of C:\MASTER           | Directory of C:\FOOBAR
  2029.                                      |
  2030.     1    TXT       0 04-07-96   6:45a| 1    TXT       0 04-07-96   6:45a
  2031.     2    TXT       0 04-07-96   6:45a| 2    TXT       0 04-07-96   6:45a
  2032.     3    TXT       0 04-07-96   6:45a| 3    TXT       0 04-07-96   6:45a
  2033.     =================================+==================================
  2034.  
  2035.     Pretty "Kewl!" eh?  <g>
  2036.  
  2037.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2038. -!- Terminate 3.00
  2039.  ! Origin: Terminate point system (1:135/71.17)
  2040.  
  2041. ─ Area: Batch Language Programming                     FI ────────────────────
  2042.   Msg#: 446                                          Date: 09 Apr 96  22:54:00
  2043.   From: Benjamin L Mcgee                             Read: Yes    Replied: No
  2044.     To: All                                          Mark:
  2045.   Subj: CHEESY WINDOWS ENVIRON
  2046. ──────────────────────────────────────────────────────────────────────────────
  2047. Here's a little somethin' I came up with so I can safely run
  2048. Binkley Term under Windows (so I can play Comet Busters while I
  2049. download QWK packets).  It just prevents me from running Bink
  2050. twice which causes all sorts of problems, and it compensates for
  2051. the lack of a true environment variable under Windows.  An old
  2052. trick I'm sure but I thought it might be helpful.
  2053.  
  2054. @echo off
  2055. cls
  2056. if exist c:\binkley\~windows.var goto error
  2057.  
  2058. :: set a HARD environment variable
  2059.    rem > c:\binkley\~windows.var
  2060.  
  2061. :dumb
  2062. :: truncate log file
  2063.    rem > c:\binkley\binkley.log
  2064.  
  2065. :: load vfos
  2066.    c:\binkley\vfoss\vfos_ibm
  2067.    c:
  2068.    cd \binkley
  2069.    bt.exe
  2070.  
  2071. :: unload vfos
  2072.    c:\binkley\vfoss\vfos_del
  2073.    del c:\binkley\~windows.var
  2074.    goto quit
  2075.  
  2076. :error
  2077.    echo.
  2078.    echo      Binkley Term is already running!
  2079.    echo Running Bink twice under Windows is NOT good!
  2080.    choice /cyn Do you wish to run Bink again anyway [Y/N]?
  2081.    if errorlevel 2 goto quit
  2082.    if errorlevel 1 goto dumb
  2083.  
  2084. :quit
  2085. Benjamin L McGee on 1:15/7
  2086.  
  2087. *Drop that pickle.
  2088.  
  2089. -!- FLAME v1.1
  2090.  ! Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
  2091.  
  2092. ─ Area: Batch Language Programming                     FI ────────────────────
  2093.   Msg#: 416                                          Date: 11 Apr 96  02:47:12
  2094.   From: Vernon Frazee                                Read: Yes    Replied: Yes
  2095.     To: All                                          Mark:
  2096.   Subj: AVGFILES.BAT
  2097. ──────────────────────────────────────────────────────────────────────────────
  2098.     Hello all,
  2099.  
  2100.     I'd sure appreciate if some of you running on MS-DOS 6.nn would run
  2101.     the following and report back the resultant "average number of files
  2102.     per directory" on your systems.
  2103.  
  2104.     @echo off
  2105.     :AVGFILES.BAT ------------------------------------------------------
  2106.      goto Begin
  2107.     :Syntax ------------------------------------------------------------
  2108.      echo.
  2109.      echo     Name: AVGFILES.BAT v1.00
  2110.      echo   Author: Vernon Frazee 04/09/96
  2111.      echo  Purpose: Calculate the average number of files
  2112.      echo           per directory for the drive specified.
  2113.      echo   Syntax: AVGFILES d:
  2114.      echo    Where: "d:" is the drive to check
  2115.      echo Requires: DOS' CHKDSK, FIND and QBASIC
  2116.      echo           (anywhere in PATH is fine).
  2117.      echo    Notes: Specified drive must contain at least one
  2118.      echo           directory and one file in the root directory.
  2119.      echo           Hidden files are NOT included.
  2120.      echo           Has only been tested on MS-DOS v6.nn
  2121.      echo.
  2122.      goto End
  2123.     :Begin -------------------------------------------------------------
  2124.      if (%1)==() goto Syntax
  2125.      if not exist %1\nul goto DriveErr
  2126.      if not exist %1\*.* goto FileErr
  2127.      dir %1|find "DIR"|find "        ">~tmp_01~.dat
  2128.      copy ~tmp_01~.dat+,,>nul
  2129.      if not exist ~tmp_01~.dat goto DirErr
  2130.     :Gather data on specified drive ------------------------------------
  2131.      echo.
  2132.      echo Counting files and directories on drive "%1" ...
  2133.      echo.
  2134.      chkdsk %1|find /v "a"|find "in"|find /v "dd">~tmp_01~.dat
  2135.     :Display CHKDEK data -----------------------------------------------
  2136.      echo CHKDSK data for drive "%1"
  2137.      echo.
  2138.      type ~tmp_01~.dat
  2139.      echo.
  2140.     :Create QBASIC program to do the calculations ----------------------
  2141.      echo OPEN "~tmp_01~.dat" FOR INPUT AS #1>~tmptmp~.bas
  2142.      echo OPEN "~tmp_02~.dat" FOR OUTPUT AS #2>>~tmptmp~.bas
  2143.      echo DO WHILE NOT EOF(1)>>~tmptmp~.bas
  2144.      echo   LINE INPUT #1, Rec$>>~tmptmp~.bas
  2145.      echo   Rec$ = MID$(Rec$, 24, 18)>>~tmptmp~.bas
  2146.      echo     FOR Count = 1 TO 18>>~tmptmp~.bas
  2147.      echo       IF MID$(Rec$, Count, 1) = "," THEN>>~tmptmp~.bas
  2148.      echo         Stn$ = "">>~tmptmp~.bas
  2149.      echo       END IF>>~tmptmp~.bas
  2150.      echo       IF NOT MID$(Rec$, Count, 1) = "," THEN>>~tmptmp~.bas
  2151.      echo         Stn$ = MID$(Rec$, Count, 1)>>~tmptmp~.bas
  2152.      echo       END IF>>~tmptmp~.bas
  2153.      echo       IF UCASE$(Stn$) = LCASE$(Stn$) THEN>>~tmptmp~.bas
  2154.      echo         x$ = x$ + Stn$>>~tmptmp~.bas
  2155.      echo       END IF>>~tmptmp~.bas
  2156.      echo     NEXT Count>>~tmptmp~.bas
  2157.      echo   PRINT #2, x$>>~tmptmp~.bas
  2158.      echo   x$ = "">>~tmptmp~.bas
  2159.      echo LOOP>>~tmptmp~.bas
  2160.      echo CLOSE>>~tmptmp~.bas
  2161.      echo OPEN "~tmp_02~.dat" FOR INPUT AS #1>>~tmptmp~.bas
  2162.      echo LINE INPUT #1, d$: LINE INPUT #1, f$>>~tmptmp~.bas
  2163.      echo a = CSNG(VAL(f$) / VAL(d$))>>~tmptmp~.bas
  2164.      echo a$ = LTRIM$(RTRIM$(STR$(a)))>>~tmptmp~.bas
  2165.      echo PRINT "Average number of files";>>~tmptmp~.bas
  2166.      echo PRINT " per directory: "; a$>>~tmptmp~.bas
  2167.      echo CLOSE : SYSTEM>>~tmptmp~.bas
  2168.     :Run QBASIC program ------------------------------------------------
  2169.      qbasic /run ~tmptmp~.bas
  2170.      echo.
  2171.      goto Cleanup
  2172.     :DriveErr ----------------------------------------------------------
  2173.      echo.
  2174.      echo    Error: Drive "%1" is not a valid drive
  2175.      goto Syntax
  2176.     :FileErr -----------------------------------------------------------
  2177.      echo.
  2178.      echo    Error: Drive "%1" must contain at least
  2179.      echo           one file in the root directory
  2180.      goto Syntax
  2181.     :DirErr ------------------------------------------------------------
  2182.      echo.
  2183.      echo    Error: Drive "%1" must contain at least
  2184.      echo           one subdirectory
  2185.      goto Syntax
  2186.     :Cleanup -----------------------------------------------------------
  2187.      for %%x in (1 2) do del ~tmp_0%%x~.dat
  2188.      del ~tmptmp~.bas
  2189.     :End --------------------------------------------------------- -vjf-
  2190.  
  2191.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2192.  
  2193. -!- OLMS 2.53p+ [ERSBN55C]
  2194.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  2195.  
  2196. ─ Area: Batch Language Programming                     FI ────────────────────
  2197.   Msg#: 418                                          Date: 09 Apr 96  08:23:00
  2198.   From: Horst Schaeffer                              Read: Yes    Replied: No
  2199.     To: Scott Sellars                                Mark:
  2200.   Subj: Batch File Help...
  2201. ──────────────────────────────────────────────────────────────────────────────
  2202. -=> quoting Scott Sellars to Clay Cherneff (5 Apr 96) <=-
  2203.  
  2204. SS> I want to generate errorlevels so i can test out my batch files.
  2205.  
  2206. some errorlevel test tools:
  2207. -+-+-----
  2208. n EL!.COM
  2209. e100 BE 81 0 AC "< t"FB "N<0r"1B "+"C0 "*"FF BA A 0 8A 1C "F"80 EB "0"
  2210. e11A ":"DA "s"6 F7 E2 1 D8 "s"ED B4 "L"CD "!"BA "3"1 B4 9 CD "!*"C0 EB
  2211. e132 F1 "EL! n"D A "sets errorlevel to n=0..255"D A "$"
  2212. rCX
  2213. 58
  2214. w
  2215. q
  2216. -+-+-----
  2217. Cut out and save (any filename), then run:  DEBUG < filename
  2218.  
  2219. -+-+-.... and to display the errorlevel:
  2220. @echo off
  2221. :: return errorlevel EL & echo
  2222. set !=
  2223. set EL=
  2224. for %%h in (0 1 2) do if errorlevel %%h00 set EL=%%h
  2225. if not errorlevel 200 set !=6 7 8 9
  2226. for %%t in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%t0 set EL=%EL%%%t
  2227. if not errorlevel 250 set !=6 7 8 9
  2228. for %%u in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%u set EL=%EL%%%u
  2229. echo Errorlevel %EL%
  2230. set !=
  2231. -+-+-
  2232.  
  2233. Horst.
  2234.  
  2235. ... Q4FM 2.10 ... horst@confusion.rmc.de
  2236.  
  2237. -!- FM 2.02 / ScanToss
  2238.  ! Origin: Don't follow leaders! (2:2480/13.75)
  2239.  
  2240. ─ Area: Batch Language Programming                     FI ────────────────────
  2241.   Msg#: 446                                          Date: 14 Apr 96  20:48:00
  2242.   From: Benjamin L Mcgee                             Read: Yes    Replied: No
  2243.     To: Jay Fuller                                   Mark:
  2244.   Subj: QUESTION CONCERNING "FIND
  2245. ──────────────────────────────────────────────────────────────────────────────
  2246.  On 04-09-96 JAY FULLER wrote to ALL...
  2247.  
  2248.  JF> Greetings everyone,
  2249.  
  2250. Hello!
  2251.  
  2252.  JF> I'm attempting to write a batch file that will do the
  2253.  JF> following.....
  2254.  JF> if find log.txt "SUCCESS" goto success
  2255.  JF> if find log.txt "ILLEGAL" goto illegal
  2256.  
  2257. Do you program in 'C' or 'C++'?  DOS's IF just ain't that good.
  2258.  
  2259.  added /i to ignore case
  2260.  added > nul to hide output of find
  2261.  find returns errorlevel 2 if an error occured while trying
  2262.  to read from the file, errorlevel 1 if no error occured but the
  2263.  search string wasn't found, and errorlevel 0 if no error occured
  2264.  and the search string was found
  2265.  
  2266. find /i "SUCCESS" LOG.TXT > nul
  2267.      if errorlevel 2 goto error
  2268.      if not errorlevel 1 goto success
  2269. find /i "ILLEGAL" LOG.TXT > nul
  2270.      if errorlevel 2 goto error
  2271.      if not errorlevel 1 goto illegal
  2272.  
  2273. Benjamin L McGee on 1:15/7
  2274.  
  2275. *Don't read everything you believe.
  2276.  
  2277. -!- FLAME v1.1
  2278.  ! Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
  2279.  
  2280. ─ Area: Batch Language Programming                     FI ────────────────────
  2281.   Msg#: 439                                          Date: 16 Apr 96  21:16:19
  2282.   From: Vernon Frazee                                Read: Yes    Replied: No
  2283.     To: Kenny Eschrich                               Mark:
  2284.   Subj: old tandy-autoexec
  2285. ──────────────────────────────────────────────────────────────────────────────
  2286. KE> I've got a real old Tandy 1000.  In order to use the disk drive, i
  2287. KE> have to type F3 before it says Starting IB DOS.  Is there any way
  2288. KE> i can do this automatically in like my autoexec or config or
  2289. KE> whatever?
  2290.  
  2291.     Press the [F3] function key?  I don't believe I've ever heard of
  2292.     that one.  Maybe it will only boot from ROM (Read-Only Memory)?
  2293.  
  2294.     Anyway, in answer to your question, probably not.  When you see:
  2295.  
  2296.       Starting MS-DOS ...
  2297.  
  2298.     nothing in CONFIG.SYS has even been processed yet.  The processing
  2299.     steps involved in a 'normal' MS-DOS startup is as follows:
  2300.  
  2301.     :Begin
  2302.  
  2303.     1) ROM program loads the bootstrap program from disk
  2304.  
  2305.     2) Bootstrap loads hidden system files and passes control to them
  2306.  
  2307.     3) ROM programs and the DOS BIOS combine to produce the I/O code
  2308.  
  2309.     4) DOS system generation begins
  2310.  
  2311.     5) Does CONFIG.SYS exist?
  2312.  
  2313.        No  - use default DOS values and goto "6)"
  2314.  
  2315.        Yes - modify DOS default parameters and install user-specified
  2316.              device drivers
  2317.  
  2318.     6) Is the command processor COMMAND.COM?
  2319.  
  2320.        No -  Invoke startup portion of the command processsor and
  2321.              goto "End"
  2322.  
  2323.        Yes - Invoke startup portion of COMMAND.COM
  2324.  
  2325.     7) Is AUTOEXEC.BAT present?
  2326.  
  2327.        No  - Issue DOS Date and Time commands and goto "End"
  2328.  
  2329.        Yes - Perform the commands in AUTOEXEC.BAT
  2330.  
  2331.     8) Terminate the startup portion of COMMAND.COM
  2332.  
  2333.     :End
  2334.  
  2335.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2336.  
  2337. -!- OLMS 2.53p+ [ERSBN55C]
  2338.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  2339.  
  2340. ─ Area: Batch Language Programming                     FI ────────────────────
  2341.   Msg#: 435                                          Date: 13 Apr 96  17:57:22
  2342.   From: Geoff Cutter                                 Read: Yes    Replied: No
  2343.     To: Bob Morton                                   Mark:
  2344.   Subj: Unique file name - was JULIAN DATE 2 ENV
  2345. ──────────────────────────────────────────────────────────────────────────────
  2346. On 07 Apr 96  10:12:00, Bob Morton wrote to Geoff Cutter
  2347.  
  2348.  BM> Unfortunately, I need granularity finer than "minute."  It is possible
  2349.  BM> two files will be created within the same minute, which would result
  2350.  BM> in identical filenames.
  2351. Perhaps reserve a character for incrementing:
  2352.  
  2353.   set jj=0
  2354.   :again
  2355.   REM  increment here
  2356.   if exist xxxxxxxx.xx%jj% goto again
  2357.   REM unique name found
  2358.  
  2359. Several programs can increment - any of these:
  2360.  
  2361.    BATCHMAN LZH     46761 10/03/94   23:13
  2362.    FDATE91C ZIP     76262 23/10/95    1:56
  2363.    GET27    ZIP    117869 31/05/95   19:41
  2364.    INCVAR   LZH      7598 27/11/93   19:08
  2365.    PSIS-500 LZH     22972 15/05/95    5:00
  2366.  
  2367. or you could modify Vernon's batch program:
  2368.  
  2369. Date: 07 Apr 94  03:04:11
  2370. From: Vernon Frazee
  2371. Subj: Auto Backups
  2372.  
  2373.     The following COUNT.BAT will keep track of how many times it has
  2374.     been run.  Change ALL of the "c:\bat" 's to the name of your
  2375.     BATch file directory on your system.  (Must be in your PATH too).
  2376.  
  2377. @echo off
  2378. :COUNT.BAT - Increments the COUNT each time run - (Self modifying!) ----
  2379.  if not (%1)==(/?) goto BEGIN
  2380.  echo Syntax: COUNT [/0]                (Optional "/0" means initialize)
  2381.  goto END
  2382. :BEGIN -----------------------------------------------------------------
  2383.  set count=1
  2384.  if not (%1)==(/0) goto COUNT
  2385. :Initialize ------------------------------------------------------------
  2386.  find /v ":%count%"<c:\bat\count.bat>c:\bat\count.bat
  2387.  goto END
  2388. :COUNT -----------------------------------------------------------------
  2389.  echo :%count%>>c:\bat\count.bat
  2390.  find /c ":%count%" c:\bat\count.bat>countemp.bat
  2391.  echo set count=%%2>--------.bat
  2392.  for %%x in (call del) do %%x countemp.bat
  2393.  del --------.bat
  2394.  set count=%count%
  2395. :END (Note: COUNT.BAT data storage below) ------------------------ -vjf-
  2396.  
  2397.     The following example, W.BAT, uses the above COUNT.BAT to keep track
  2398.     of how many times it has been run.  Change whatever you like to suit
  2399.     your specific requirements:
  2400.  
  2401. @echo off
  2402. :W.BAT - Loads WORD each time run and also does a "modified
  2403. :        files only" backup to drive B: every 30th time run.
  2404. :Notes - Requires COUNT.BAT and DOS's XCOPY both be available
  2405. :        somewhere in current PATH.
  2406. :Begin --------------------------------------------------------
  2407.  echo Loading: WORD ...
  2408.  c:
  2409.  cd\word
  2410.  word
  2411.  call count
  2412.  echo.
  2413.  echo Word has been run %count% times since last backup to B:
  2414.  if not (%count%)==(30) goto DONE
  2415. :Backup -------------------------------------------------------
  2416.  echo.
  2417.  echo Please insert your "Word Backup Diskette" in drive
  2418.  echo B: and press any key to begin copying file(s). . .
  2419.  echo.
  2420.  pause>nul
  2421.  xcopy c:\word b:\ /m /s /e
  2422.  call count /0
  2423. :DONE ---------------------------------------------------------
  2424.  cd\
  2425.  echo.
  2426. :End ---------------------------------------------------- -vjf-
  2427.  
  2428.  
  2429. regds   Geoff
  2430.  
  2431.  
  2432. -!- Blue Wave/DOS v2.30
  2433.  ! Origin: TARDIS BBS (03) 9819 7093 (3:633/260)
  2434.  
  2435. ─ Area: Batch Language Programming                     FI ────────────────────
  2436.   Msg#: 435                                          Date: 23 Apr 96  11:26:07
  2437.   From: Vernon Frazee                                Read: Yes    Replied: No
  2438.     To: Roy Reed                                     Mark:
  2439.   Subj: DECIMAL TO HEX
  2440. ──────────────────────────────────────────────────────────────────────────────
  2441. RR> Here is a decimal to hex converter, but it's 400 some bytes.
  2442. RR> -+-+--------------------------------------------------------
  2443. RR> n BREAKOUT.LZH
  2444. RR> e100 FC "+"ED BE 82 1 B9 80 FD B4 "?U[VZ"CD "!r`PY"F7 D8 99 ...
  2445.  
  2446.     How about a simple BATch-file/QBASIC solution:
  2447.  
  2448.     @echo off
  2449.     :HEX.BAT ----------------------------------------------
  2450.      if (%1)==() goto Syntax
  2451.      if (%1)==(/?) goto Syntax
  2452.     :Begin ------------------------------------------------
  2453.      echo A$=HEX$(%1):? A$:system>~tmptmp~.bas
  2454.      qbasic /run ~tmptmp~.bas
  2455.      del ~tmptmp~.bas
  2456.      goto End
  2457.     :Syntax -----------------------------------------------
  2458.      echo Syntax: HEX nnn
  2459.      echo  Where:     nnn is a Decimal number that you want
  2460.      echo                 converted to a Hexadecimal number
  2461.      echo   Note:     nnn can be up to nine 9's worth.
  2462.     :End -------------------------------------------- -vjf-
  2463.  
  2464.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2465.  
  2466. -!- OLMS 2.53p+ [ERSBN55C]
  2467.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  2468.  
  2469. ─ Area: Batch Language Programming                     FI ────────────────────
  2470.   Msg#: 443                                          Date: 23 Apr 96  11:26:06
  2471.   From: Vernon Frazee                                Read: Yes    Replied: No
  2472.     To: Malcolm Campbell                             Mark:
  2473.   Subj: JULIAN DATE 2 ENV
  2474. ──────────────────────────────────────────────────────────────────────────────
  2475. AG> In a message originally to Malcolm Campbell, Vernon Frazee said:
  2476. AG> :ZIPLOG.BAT - Change to the directory containing the .LOG file(s)
  2477. AG> to ZIP and type "ZIPLOG" (no quotes).
  2478.  
  2479. MC> I seem to have missed this   ;-(     Can you please repost?
  2480.  
  2481.     Here you go:
  2482.  
  2483.     :ZIPLOG.BAT - Change to the directory containing the .LOG
  2484.     :             file(s) to ZIP and type "ZIPLOG" (no quotes).
  2485.     :Note: Do NOT put a "@echo off" at the beginning of this file!
  2486.     :Begin -------------------------------------------------------
  2487.      @if (%1)==(/?) goto Syntax
  2488.      @if (%1)==(!!) goto GetMDY
  2489.      @if (%1)==(!) prompt set date=!! $d
  2490.      @if (%1)==(!) goto End
  2491.      @echo off
  2492.      for %%x in (date mm dd yy) do set %%x=
  2493.      command /c %0 !>~tmp_01~.bat
  2494.      for %%x in (call del) do %%x ~tmp_01~.bat
  2495.      %0 %date%
  2496.     :GetMDY ------------------------------------------------------
  2497.      shift|shift
  2498.      echo;;|choice /c:;%1%; "~tmp_02~ ">~tmp_01~.bat
  2499.      echo set mm=%%2%%3>>~tmp_02~.bat
  2500.      echo set dd=%%5%%6>>~tmp_02~.bat
  2501.      for %%x in (1 2) do echo shift>>~tmp_02~.bat
  2502.      echo set yy=%%8%%9>>~tmp_02~.bat
  2503.      for %%x in (call del) do %%x ~tmp_01~.bat
  2504.      del ~tmp_02~.bat
  2505.     :Zip'em ------------------------------------------------------
  2506.      pkzip -ex %yy%%mm%%dd% *.LOG
  2507.      dir %yy%%mm%%dd%.zip
  2508.     :Cleanup -----------------------------------------------------
  2509.      for %%x in (date mm dd yy) do set %%x=
  2510.     :End ---------------------------------------------------------
  2511.  
  2512.     Requires CHOICE.COM and maybe 30 bytes free environment space.
  2513.  
  2514. MC> Thanks!
  2515.  
  2516.     Sure; no problem.
  2517.  
  2518.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2519.  
  2520. -!- OLMS 2.53p+ [ERSBN55C]
  2521.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  2522.  
  2523. ─ Area: Batch Language Programming                     FI ────────────────────
  2524.   Msg#: 444                                          Date: 25 Apr 96  17:25:00
  2525.   From: Ron Warder                                   Read: Yes    Replied: No
  2526.     To: Jerry Dugal                                  Mark:
  2527.   Subj: count lines in txt file
  2528. ──────────────────────────────────────────────────────────────────────────────
  2529.  >I need to count the # of lines in a txt file, any one have an idea on the
  2530.  >best way to go about doing this?
  2531.  
  2532.  Here ya go, courtesy of Prof. Timo Salmi, Finlands resident DOS guru:
  2533.  
  2534.    :: LC.BAT -----------------------------------------------------------
  2535.    @echo off
  2536.    echo +---------------------------------------------------+
  2537.    echo . Count the number of lines in the given TEXT file  .
  2538.    echo . By Prof. Timo Salmi, ts@chyde.uwasa.fi, 6-Dec-91  .
  2539.    echo +---------------------------------------------------+
  2540.  
  2541.    rem If no parameters then give the instructions
  2542.    if "%1"=="" goto _help
  2543.  
  2544.    rem Check that the file exists
  2545.    if not exist %1 goto _nofind
  2546.  
  2547.    rem Count the lines
  2548.   :: Note: As posted in TSBATxx.ZIP, the line below has an error in the
  2549.   :: find string. The single "%" should have been "%%", since the single
  2550.   :: percent sign is absorbed by DOS's batch handler.
  2551.   :: find /v /c "2O4$fD%h38+" %1
  2552.    find /v /c "2O4$fD%%h38+" %1
  2553.    goto _out
  2554.  
  2555.    :_help
  2556.    echo.
  2557.    echo Usage: LC FileName
  2558.    goto _out
  2559.  
  2560.    :_nofind
  2561.    echo.
  2562.    echo File %1 not found
  2563.    goto _out
  2564.  
  2565.    :_out
  2566.    echo on
  2567.    :: End of LC.BAT ----------------------------------------------------
  2568.  
  2569.   This gives you a count of the number of lines in the specified file by
  2570. telling you how many lines -don't- contain the string "2O4$fD%%h38+". Any
  2571. string will work, so long as it is unique enough to -not- appear in the file
  2572. specified. The string given is as unique as any that I have ever come up with.
  2573. If the file being operated on contains that particular string, the result from
  2574. LC.BAT will be off by the number of lines that contain the search string.
  2575.  
  2576.   Hope this helps solve the problem ....
  2577.  
  2578.  
  2579.  
  2580.  
  2581. -!- SLMAIL v4.0a  (#0304)
  2582.  ! Origin: Free Spirit =*= SL/RIP =*= 301-283-0917 =*= V32b/HST (1:109/132)
  2583.  
  2584. ─ Area: Batch Language Programming                     FI ────────────────────
  2585.   Msg#: 437                                          Date: 24 Apr 96  20:57:24
  2586.   From: Larry Nelson                                 Read: Yes    Replied: No
  2587.     To: Bill Martin                                  Mark:
  2588.   Subj: For/in/Do ?
  2589. ──────────────────────────────────────────────────────────────────────────────
  2590.          BILL:
  2591.  
  2592.  Subject: FOR/DO...  Clean and Concise explinations?
  2593.  
  2594. BM> Can someone offer c clear idea of the usage for "FOR" / "DO".  I for BM>
  2595. one reason or another am having a problem getting a grasp on this. BM>
  2596. Especially when it is used to run multiple functions on multiple files...
  2597. Maybe a BM> "easy" example, as well as an intermediate on and an advanced one?
  2598.  
  2599.       The problem you mention is going to need a recursion routine
  2600.       but let's start off with a basic For command.
  2601.  
  2602.    FOR/IN/DO LOOP:
  2603.       The For/in/Do loop is so named for the three words needed to
  2604.       make it work. DOS help has a bit to say on the subject and
  2605.       while that is a good place to satrt there is a good deal
  2606.       more to know about FOR. For is made up of three main parts.
  2607.       The call "for", the set "in (.....)", and the command.
  2608.  
  2609.             for %%q  in (this is a for loop)    do echo %%q
  2610.             ^    ^       ^^^^ ^^ ^ ^^^ ^^^^         ^    ^
  2611.               |                 |                   |
  2612.           The call   The set (5 strings)        The command
  2613.  
  2614.       For cycles through the 5 strings in this set one at a time with
  2615.       the help of %%q. %%q is a local variable that takes on the value
  2616.       of each part of the set in turn.
  2617.       In people speak one could translate the first cycle of this
  2618.       For/in/DO loop as "For this do echo this". The next cycle, "For
  2619.       is do echo is".....and so on. the screen result would be......
  2620.  
  2621.             this
  2622.             is
  2623.             a
  2624.             for
  2625.             loop
  2626.  
  2627.       Echoing a list of words probably isn't the most exciting
  2628.       thing you have seen a Batch command do so hows about putting
  2629.       5 file names in the set....
  2630.  
  2631.       For %%q in (this.com is.bat a.txt for.lst loop.pft) do del %%q
  2632.  
  2633.       ...and now we have a tool that deletes 5 files.
  2634.       For nibbels at the edges of real loopdom in that it is controled
  2635.       by the number of strings in the set. The efforts needed to get
  2636.       any great amount of work out of it, however, boarder on the
  2637.       gymnastic.
  2638.       And now to your more advanced question. For can do something
  2639.       to a bunch of things or it can do a bunch of somethings to
  2640.       one thing, but it can't do a bunch of somethings to a bunch
  2641.       of things. Not wothout help that is, and that is where
  2642.       recursion comes in.
  2643.  
  2644.  RECURSIONS:
  2645.       Recursion happens when a Batch file calls itself. Why? You say.
  2646.       Well one reason a .bat might need to recycle itself is to run
  2647.       multiple functions on multiple files. For/in/do loops won't nest,
  2648.       try it and DOS will slap your hands.
  2649.  
  2650.       This....
  2651.  
  2652.          for %%q in (dos mail wrk) do for %%a in (*.bak *.tmp) del %%a
  2653.  
  2654.       will get you this....
  2655.  
  2656.          FOR cannot be nested
  2657.  
  2658.       Oh poo! Well not to fret, Recursion to the rescue......
  2659.  
  2660.          @echo off
  2661.          cls
  2662.             if not %1! == ! goto %1
  2663.             for %%q in (dos mail wrk) do call %0 step2 %%q
  2664.             goto L8r
  2665.          :step2
  2666.             for %%q in (c:\%2\*.bak c:\%2\*.tmp) do del %%q
  2667.          :L8r
  2668.  
  2669.       Not so pretty as the line we tried above, but it has the advantage
  2670.       of not offending Command.com. The first "For" recalls the .bat "%0"
  2671.       with the parameters "step2" and "%%q" which is "dos", "mail"
  2672.       and "wrk" in turn. The second "For" processes, in turn, each
  2673.       directory by deleting each ".bak" and ".tmp" file from the
  2674.       directory named in that current cycle of For#1. "c:\%2\%%q"
  2675.       in the first cycle of For#2 reads as c:\dos\*.bak. In the
  2676.       second cycle it reads "c:\dos\*.tmp"
  2677.       Neat Huh!
  2678.  :L8r
  2679.                  Larry
  2680.             ..... In a pinch a stone ax still works.....
  2681.  
  2682. -!- Maximus 2.02
  2683.  ! Origin: MSDOS MAXIMUS BBS (1:343/101)
  2684.  
  2685. ─ Area: Batch Language Programming                     FI ────────────────────
  2686.   Msg#: 408                                          Date: 26 Apr 96  17:38:12
  2687.   From: Vernon Frazee                                Read: Yes    Replied: No
  2688.     To: Larry Nelson                                 Mark:
  2689.   Subj: 1aday.bat             2/2
  2690. ──────────────────────────────────────────────────────────────────────────────
  2691.    [ ...Continued From Previous Message ]
  2692.  
  2693.     @echo off
  2694.     :1ADAY.BAT runs a specified program once-a-day only ---------------
  2695.      if not (%0)==(1ADAY.BAT) 1ADAY.BAT %1 %2 %3 %4 %5 %6 %7 %8 %9
  2696.      if (%1)==(/?) goto Syntax
  2697.      if not (%1)==() goto Begin
  2698.     :Syntax -----------------------------------------------------------
  2699.      echo      Name: 1ADAY.BAT
  2700.      echo   Purpose: Run a specified command only once a day
  2701.      echo    Syntax: 1ADAY program_name/command [parms...]
  2702.      echo            1ADAY /C   clears all entries
  2703.      echo            1ADAY /?   displays this help
  2704.      echo   Example: 1ADAY DEFRAG C: /F /SN
  2705.      echo  Requires: DOS v6.nn+'s FIND.EXE (in current PATH) and
  2706.      echo            29 bytes free environment space.
  2707.      echo Important: 1ADAY.BAT is self modifying!  It keeps track of
  2708.      echo            when and what was run at the end of itself.
  2709.      echo            Therefore all occurences of "1aday.bat" below
  2710.      echo            must be changed to include the complete path to
  2711.      echo            1ADAY.BAT.  From "1aday.bat" to "c:\bat\1aday.bat"
  2712.      echo            for example.
  2713.      goto End
  2714.     :Begin ------------------------------------------------------------
  2715.      set ~prefix~=:
  2716.      set ~prefix~=%~prefix~%:!
  2717.      for %%x in (c C) do if (%1)==(/%%x) goto ClearData
  2718.     :GetDate ----------------------------------------------------------
  2719.      echo set ~date~=%%3>~tmptmp1.bat
  2720.      dir/-p ~tmptmp1.bat|find "~TMPTMP1 BAT">~tmptmp2.bat
  2721.      for %%x in (call del) do %%x ~tmptmp2.bat
  2722.      del ~tmptmp1.bat
  2723.     :Has current command already been run today? ----------------------
  2724.      find/i "%~prefix~%%~date~%%1%2%3%4%5%6%7%8%9" 1aday.bat>nul
  2725.      if errorlevel 1 goto Nope
  2726.      :Yep ----------------------------
  2727.       echo The command:
  2728.       echo %1 %2 %3 %4 %5 %6 %7 %8 %9
  2729.       echo has already been run today.
  2730.       goto Cleanup
  2731.      :Nope ---------------------------
  2732.       echo %~prefix~%%~date~%%1%2%3%4%5%6%7%8%9>>1aday.bat
  2733.       call %1 %2 %3 %4 %5 %6 %7 %8 %9
  2734.       goto Cleanup
  2735.     :ClearData --------------------------------------------------------
  2736.      type 1aday.bat|find /v "%~prefix~%">1aday.bat
  2737.     :Cleanup ----------------------------------------------------------
  2738.      rem for %%x in (prefix date) do set ~%%x~=
  2739.     :End - Data storage begins below. - Type "1ADAY /?" for info. -----
  2740.     ::!04-23-96dirg:\*.*
  2741.  
  2742.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2743.  
  2744. -!- OLMS 2.53p+ [ERSBN55C]
  2745.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  2746.  
  2747. ─ Area: Batch Language Programming                     FI ────────────────────
  2748.   Msg#: 419                                          Date: 26 Apr 96  12:57:21
  2749.   From: Michael Barnes                               Read: Yes    Replied: No
  2750.     To: Jason Laviska                                Mark:
  2751.   Subj: Command line arguments
  2752. ──────────────────────────────────────────────────────────────────────────────
  2753. Jason Laviska wrote in a message to All:
  2754.  
  2755.  JL>      Is there a way to transmit the entire list of command
  2756.  JL> parameters to a program which will allow me to use more than nine
  2757.  JL> arguments using a batch file in dos 6.x?  Right now all I have
  2758.  JL> is...
  2759.  JL> @Echo off
  2760.  JL> C:\LASRCOMP\LASRCOMP.EXE %1 %2 %3 %4 %5 %6 %7 %8 %9
  2761.  JL> If Errorlevel==0 Echo Files are identical
  2762.  JL> If Errorlevel==255 Echo Files are different
  2763. 'Lo Jason,
  2764.  
  2765.   Yes, use the shift command. (as in the example below)
  2766. but first..  you must list your errorlevel checks in reverse order- such as:
  2767. IF ERRORLEVEL 255 GOTO ERROR255
  2768. IF ERRORLEVEL 254 GOTO ERROR254
  2769. ~~~
  2770. IF ERRORLEVEL 1   GOTO ERROR001
  2771. IF ERRORLEVEL 0   GOTO ERROR000
  2772. -!- Now on to the example ---
  2773. 10PLUS.BAT
  2774. :START
  2775. IF '%2'=='' THEN SET LASTPARAM=TRUE
  2776. ECHO %1>>OUTPUT.TXT
  2777. IF '%LASTPARAM%'=='TRUE' THEN GOTO END
  2778. SHIFT
  2779. GOTO START
  2780. :END
  2781. TYPE OUPUT.TXT |MORE
  2782. -!- So, type:
  2783. 10PLUS ONE 2 THREE 4 FIVE 6 SEVEN 8 NINE 10 ELEVEN 12 THIRTEEN 14 [ENTER]
  2784. and the file OUPUT.TXT will contain all 14 parameters. (the magic is in the
  2785. shift)
  2786.  
  2787. Sincerely,
  2788.  
  2789. Michael
  2790. -!- GEcho 1.20/Pro
  2791.  ! Origin:   On a clear disk, you can seek for ever      (1:271/210)
  2792.  
  2793. ─ Area: Batch Language Programming                     FI ────────────────────
  2794.   Msg#: 439                                          Date: 26 Apr 96  17:38:10
  2795.   From: Vernon Frazee                                Read: Yes    Replied: No
  2796.     To: Ronald Mendoza                               Mark:
  2797.   Subj: Random message display
  2798. ──────────────────────────────────────────────────────────────────────────────
  2799. RM> Now what exactly do you mean by "CHOICE.COM" is required in the PATH
  2800. RM> somewhere...How do you do this?? ANything special? Or do I just add
  2801. RM> "c:\dos\choice.com" to my path in my autoexec.bat???? Please clarify
  2802. RM> this for me! Thanks a lot!
  2803.  
  2804.     At the DOS prompt, you can type:
  2805.  
  2806.       PATH
  2807.  
  2808.     to view the directories in your current PATH.
  2809.  
  2810.     If you keep CHOICE.COM in your C:\DOS directory, (most do), just
  2811.     make sure the directory:
  2812.  
  2813.       C:\DOS
  2814.  
  2815.     is one of the directories in your current PATH.
  2816.  
  2817.     For example, here is the beginning of my current PATH (displayed by
  2818.     typing "PATH"):
  2819.  
  2820.       PATH=g:\key;c:\bat;c:\util;c:\dos;c:\pk;c:\scan
  2821.                                  ~~~~~~
  2822.  
  2823.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2824.  
  2825. -!- OLMS 2.53p+ [ERSBN55C]
  2826.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  2827.  
  2828. ─ Area: Batch Language Programming                     FI ────────────────────
  2829.   Msg#: 440                                          Date: 25 Apr 96  10:45:48
  2830.   From: Vernon Frazee                                Read: Yes    Replied: No
  2831.     To: Jesse Jordan                                 Mark:
  2832.   Subj: Random numerical stuff
  2833. ──────────────────────────────────────────────────────────────────────────────
  2834.     Hello Jesse,
  2835.  
  2836.     If I've already answered the following, please ignore this dupe.
  2837.     BBN, "Buggy BossNode" ;(
  2838.  
  2839. JJ> Great so far! I have no idea how you got the date in this message,
  2840. JJ> but could you get the little split-seconds? I could use that
  2841. JJ> variable for the random number. And since it needs to be under 100,
  2842. JJ> 60 works great... That way, the role-playing character can start
  2843. JJ> low, and work stats up. See, in using seconds, I usually get stats
  2844. JJ> like this:
  2845. JJ>   15
  2846. JJ>   22  <--doesn't take this much time, but the example stands of it
  2847. JJ>   35  <--passing from lesser to greater.
  2848. JJ>   46
  2849. JJ>   56
  2850. JJ> It creates them in numerical order as the calls to the
  2851. JJ> variable-catching bat are made.
  2852. JJ> To speed things up, how about a bat the only catches the
  2853. JJ> splitsecond? <I couldn't do it if my life depended on it.>
  2854.  
  2855.     @echo off
  2856.     :RND.BAT - Copies the two digit hundredths-of-a-second
  2857.     :          from the current system time into an
  2858.     :          environment variable named RND.  Requires
  2859.     :          DOS's CHOICE.COM (somewhere in the PATH) and
  2860.     :          17 bytes free environment space.
  2861.     :Begin -------------------------------------------------
  2862.      ver|time>~rndtmp~.bat
  2863.      echo set rnd=%%3>current.bat
  2864.      call ~rndtmp~.bat
  2865.      del current.bat
  2866.      echo;;|choice /c:;%rnd%; "current ">~rndtmp~.bat
  2867.      for %%x in (1 2 3 4 5 6 7 8) do echo shift>>current.bat
  2868.      echo if not (%%1)==(.) shift>>current.bat
  2869.      echo if (%%1)==(.) shift>>current.bat
  2870. -->  echo set rnd=%%1%%2>>current.bat
  2871.      for %%x in (call del) do %%x ~rndtmp~.bat
  2872.      del current.bat
  2873.      echo RND=%rnd%
  2874.     :End --------------------------------------------- -vjf-
  2875.  
  2876.     Note: You can simply change the "%%1%%2" in the line marked with
  2877.           "-->" to "%%2%%1" if you'd rather have the second digit of the
  2878.           100ths of a second first.  For example, as it is, if the
  2879.           current time was "10:49:15.24a" the RND evar would be "24".
  2880.           If you reverse the %%1%%2 to %%2%%1, it would be "42".
  2881.  
  2882. JJ> Thanks for your help!
  2883.  
  2884.     Sure, no problem.
  2885.  
  2886.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2887. -!- Terminate 4.00
  2888.  ! Origin: Terminate IS the final terminal! (1:135/71.17)
  2889.  
  2890. ─ Area: Batch Language Programming                     FI ────────────────────
  2891.   Msg#: 418                                          Date: 26 Apr 96  08:36:01
  2892.   From: Greg Smith                                   Read: Yes    Replied: No
  2893.     To: Jerry Dugal                                  Mark:
  2894.   Subj: count lines in txt file
  2895. ──────────────────────────────────────────────────────────────────────────────
  2896. For reasons that are still not clear, Jerry Dugal said...
  2897.  
  2898.  JD> I need to count the # of lines in a txt file, any one have an idea on
  2899.  JD> the  best way to go about doing this?
  2900.  
  2901. Here we have one of those cases where we use a DOS command for something
  2902. completely different than what it was intended for...
  2903.  
  2904. @echo off
  2905. :: LCOUNT.BAT  - puts line count of specified file into LINES env variable
  2906. :: ---------------------------
  2907. :: Usage: LCOUNT filename.ext
  2908. :: ---------------------------
  2909. if (%1) == () EXIT
  2910. echo IF (%%1%) == () GOTO RERUN > --------.BAT
  2911. echo SET LINES = %%2% >> --------.BAT
  2912. echo  GOTO EXIT >> --------.BAT
  2913. echo :RERUN >> --------.BAT
  2914. find /V /C "-[gobbley&gook]-" %1 >> --------.BAT
  2915. :: you can use any "string" that you KNOW is NOT in the TEXT file to search.
  2916. echo :EXIT >> --------.BAT
  2917. call --------.BAT
  2918. del --------.BAT
  2919.  
  2920.  
  2921. -!- JMail-G 2.80a
  2922.  ! Origin: ACCENT! - Chandler, AZ - (602) 814-7894 (1:114/402)
  2923.  
  2924. ─ Area: Batch Language Programming                     FI ────────────────────
  2925.   Msg#: 429                                          Date: 26 Apr 96  12:03:11
  2926.   From: Vernon Frazee                                Read: Yes    Replied: No
  2927.     To: Jerry Dugal                                  Mark:
  2928.   Subj: count lines in txt file
  2929. ──────────────────────────────────────────────────────────────────────────────
  2930. JD> I need to count the # of lines in a txt file, any one have an idea
  2931. JD> on the best way to go about doing this?
  2932.  
  2933.     If you mean count all the lines in a text file that:
  2934.  
  2935.       1) actually contain text (in other words, don't count the
  2936.          blank lines)
  2937.  
  2938.     and
  2939.  
  2940.       2) all the lines of text have at least one space somewhere in
  2941.          the line
  2942.  
  2943.     then the following DOS command will work:
  2944.  
  2945.       TYPE name_of_file|FIND /C " "
  2946.  
  2947.  
  2948.     If you want to count _ALL_ of the lines in a text file AND you know
  2949.     that NONE of the lines would contain some strange sequence of
  2950.     characters like say:
  2951.  
  2952.       ~!1@2#3$4~
  2953.  
  2954.     the following DOS command will work:
  2955.  
  2956.       TYPE name_of_file|FIND /C /V  "~!1@2#3$4~"
  2957.  
  2958.  
  2959.     And if you wanted to do something like count only the lines that had
  2960.     the string "the" in them, either upper- or lower-case, the command
  2961.     would be:
  2962.  
  2963.       TYPE name_of_file|FIND /C /I "the"
  2964.  
  2965.  
  2966.     How many fonts are being loaded in Windows 3.1n's WIN.INI?
  2967.  
  2968.       TYPE C:\WINDOWS\WIN.INI|FIND /C ".FO"
  2969.  
  2970.  
  2971.     'Kewl' eh? <g>
  2972.  
  2973.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  2974. -!- Terminate 4.00
  2975.  ! Origin: Get real, get better, get faster, get Terminate! (1:135/71.17)
  2976.  
  2977. ─ Area: Batch Language Programming                     FI ────────────────────
  2978.   Msg#: 448                                          Date: 28 Apr 96  11:58:00
  2979.   From: Benjamin L Mcgee                             Read: Yes    Replied: No
  2980.     To: Vernon Frazee                                Mark:
  2981.   Subj: ERRORLEVEL
  2982. ──────────────────────────────────────────────────────────────────────────────
  2983.  BLM> if errorlevel 255 echo 255
  2984.  BLM> if etc. etc. etc. ...
  2985.  BLM> if not errorlevel 1 echo 0
  2986.  
  2987.  VF>     How about something just a wee bit shorter (and faster)
  2988.  VF> than the above 257-line (minimum) monster:
  2989.  
  2990. [inspiring code deleted....]
  2991.  
  2992. Your code inspired me to pen the following, which seemes to work
  2993. fine for me.  Do you see any potential (or current) problems with
  2994. it.  Thanx blm
  2995.  
  2996. @echo off
  2997. :: EL.BAT blm 1996
  2998. :: Set "ERROR" environment variable to last ERRORLEVEL
  2999. :: and echo ERRORLEVEL
  3000.  
  3001. set error=
  3002. set errh=0
  3003. set errm=0
  3004. set errl=0
  3005.  
  3006. for %%h in (1 2) do if errorlevel %%h00 set errh=%%h
  3007. for %%m in (1 2 3 4 5 6 7 8 9) do if errorlevel %errh%%%m0 set errm=%%m
  3008. for %%l in (1 2 3 4 5 6 7 8 9) do if errorlevel %errh%%errm%%%l set errl=%%l
  3009.  
  3010. for %%e in (%errh% %errm% %errl%) do if not "%%e"=="0" set error=%error%%%e
  3011. if "%error%"=="" set error=0
  3012.  
  3013. set errh=
  3014. set errm=
  3015. set errl=
  3016.  
  3017. echo Errorlevel %error%
  3018. Benjamin L McGee on 1:15/7
  3019.  
  3020. *FACT: There are more horse's asses than there are horses
  3021.  
  3022. -!- FLAME v1.1
  3023.  ! Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
  3024.  
  3025. ─ Area: Batch Language Programming                     FI ────────────────────
  3026.   Msg#: 445                                          Date: 29 Apr 96  18:42:00
  3027.   From: Jason Laviska                                Read: Yes    Replied: No
  3028.     To: All                                          Mark:
  3029.   Subj: Command line arguments
  3030. ──────────────────────────────────────────────────────────────────────────────
  3031.      After all useful messages concerning the SHIFT function, I would like to
  3032. say thanks to those who have responded with tips and hints.  I have pretty much
  3033. combined all the messages regarding this topic and ended up using this batch
  3034. file below.  This message is mainly for those people who helped me, but
  3035. couldn't come up with the full solution.  If you see any problems with it, let
  3036. me know.
  3037.  
  3038.   @Echo Off
  3039.   If Exist LCDATA.TMP Del LCDATA.TMP >Nul
  3040.   If "%1"=="" Goto ERROR
  3041.   :START
  3042.   If "%1"=="" Goto RUNLC
  3043.   Echo %1 >>LCDATA.TMP
  3044.   SHIFT
  3045.   GOTO START
  3046.   :ERROR
  3047.   Echo No Command Line Parameters!
  3048.   C:\LASRCOMP\LASRCOMP.EXE /?
  3049.   Goto END
  3050.   :RUNLC
  3051.   C:\LASRCOMP\LASRCOMP.EXE @LCDATA.TMP
  3052.   Del LCDATA.TMP >Nul
  3053.   :END
  3054.  
  3055.      First it will check to see if the temporary exists, and if so, it will
  3056. delete it.  Next, it will create a file called LCDATA.TMP and store all the
  3057. command line variables by looping the command arguments using the SHIFT
  3058. command.  If there are no arguments were given to the batch file, it will
  3059. display the help file for LASRCOMP.EXE using the /? switch.  Afterwards, it
  3060. will then run the program using the temporary file as its command parameter.
  3061. (LaserCompare WILL read the file contents and use it as its command line if you
  3062. put a "@" sign in front of it.)   In the end, the batch file will discard the
  3063. temporary file.
  3064. - Jason Laviska
  3065.  
  3066.  ! Origin: _C_E_N_T_R_A_L__S_T_A_T_I_O_N_ * OS/2 * Melbourne,FL * (1:374/31)
  3067.  
  3068. ─ Area: Batch Language Programming                     FI ────────────────────
  3069.   Msg#: 434                                          Date: 29 Apr 96  05:31:26
  3070.   From: Vernon Frazee                                Read: Yes    Replied: No
  3071.     To: Gary Smith                                   Mark:
  3072.   Subj: ERRORLEVEL
  3073. ──────────────────────────────────────────────────────────────────────────────
  3074. VF> How about something just a wee bit shorter (and faster) than the
  3075. VF> above 257-line (minimum) monster:
  3076.  
  3077. GS> Your routine is prretty cool, but this one is shorter and uses no
  3078. GS> more than seven bytes of environment space.
  3079.  
  3080. GS> @echo off
  3081. GS> ::
  3082. GS> :: Set environment variable EL to the current error level,
  3083. GS> :: expressed as a 1-3 digit number (leading zeros suppressed).
  3084. GS> ::
  3085. GS> for %%h in (0 1 2) do if errorlevel %%h00 set EL=%%h
  3086. GS> if %EL% == 0 set EL=
  3087. GS> if errorlevel 200 for %%t in (0 1 2 3 4 5) do if errorlevel
  3088. GS>    2%%t0 set EL=2%%t
  3089. GS> if not errorlevel 200 for %%t in (0 1 2 3 4 5 6 7 8 9) do if
  3090. GS>    errorlevel %EL%%%t0 set EL=%EL%%%t
  3091. GS> if %EL% == 0 set EL=
  3092. GS> if errorlevel 250 for %%u in (0 1 2 3 4 5) do if errorlevel
  3093. GS>    25%%u set EL=%EL%%%u
  3094. GS> if not errorlevel 250 for %%u in (0 1 2 3 4 5 6 7 8 9) do if
  3095. GS>    errorlevel %EL%%%u set EL=%EL%%%u
  3096. GS> echo Error level = %EL%
  3097. GS>
  3098. GS> Note: indented lines are continuations for the preceding lines, so
  3099. GS> there are actually only seven "working" lines in the file. If you
  3100. GS> want a result that's always three digits, instead of dropping
  3101. GS> leading zeros, remove the two lines which begin "if %EL% == 0".
  3102.  
  3103.     Pretty cool!  Beat my filesize by a single byte.  Yours was 444
  3104.     compared to mine at 445.  Went to work on yours though and durn
  3105.     near whittled 100 bytes, down to 348:
  3106.  
  3107.       @echo off
  3108.       set A=0 1 2 3 4 5
  3109.       set B=%A% 6 7 8 9
  3110.       set C=errorlevel
  3111.       set D=) do if %C%
  3112.       set F=for %%x in (
  3113.       set G= set E
  3114.       %F%0 1 2%D% %%x00%G%=%%x
  3115.       if %C% 200 %F%%A%%D% 2%%x0%G%=2%%x
  3116.       if not %C% 200 %F%%B%%D% %E%%%x0%G%=%E%%%x
  3117.       if %C% 250 %F%%A%%D% 25%%x%G%=%E%%%x
  3118.       if not %C% 250 %F%%B%%D% %E%%%x%G%=%E%%%x
  3119.       echo %E%
  3120.       %F%A B C D E F G) do set %%x=
  3121.  
  3122.     Applied the same technique to mine and it's now at 329 bytes:
  3123.  
  3124.       @echo off
  3125.       set F=for %%x in (
  3126.       set E=errorlevel|%F%A B) do set %%x=0 1 2 3 4 5
  3127.       if not %E% 250 set A=%A% 6 7 8 9
  3128.       if not %E% 200 set B=%A%
  3129.       %F%1 2) do if %E% %%x00 set C=%%x
  3130.       %F%%B%) do if %E% %C%%%x0 set D=%%x
  3131.       if (%C%%D%)==(0) set D=
  3132.       set C=%C%%D%
  3133.       %F%%A%) do if %E% %C%%%x set D=%C%%%x
  3134.       echo %D%
  3135.       %F%A B C D E F) do set %%x=
  3136.  
  3137.     (Yours displays errorlevels with leading zeros, mine does not).
  3138.  
  3139.     Of course as you can tell, with these particular variations I wasn't
  3140.     worried about environment space nor the number of lines.  All I was
  3141.     really concerned with is simply the fewest number of bytes required
  3142.     to get the job done, (and, using nothing more than COMMAND.COM).
  3143.  
  3144.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  3145. -!- Terminate 4.00
  3146.  ! Origin: Terminate is available from a dealer near you! (1:135/71.17)
  3147.  
  3148. ─ Area: Batch Language Programming                     FI ────────────────────
  3149.   Msg#: 443                                          Date: 07 May 96  21:12:10
  3150.   From: Andy Guess                                   Read: Yes    Replied: No
  3151.     To: Larry Kwiatkowski                            Mark:
  3152.   Subj: FOR/DO...  Clean and Conc
  3153. ──────────────────────────────────────────────────────────────────────────────
  3154. LK->Hokay - I understand the for-in-do function. Could anyone hazard a guess wh
  3155. LK->it will not work, for example, in autoexec with multiple "set" commands? Th
  3156. LK->has always puzzled me.
  3157.  
  3158. For multiple SET's on one line, use:
  3159. SET variable1=value1|SET variable2=value2|SET variable3=value3
  3160. You can do that as long as the line is less than 128 characters.
  3161. Hope I helped!
  3162. Cya,
  3163. -AG
  3164.  
  3165.  
  3166.  * SLMR 2.1a * Is this yours? Your dog left it on my lawn ...
  3167.  
  3168. -!-
  3169.  ! Origin: * My Place BBS * Bowie, Md USA * V.34 * (301)805-1602 * (1:109/570)
  3170.  
  3171. ─ Area: Batch Language Programming                     FI ────────────────────
  3172.   Msg#: 450                                          Date: 06 May 96  14:58:47
  3173.   From: Vernon Frazee                                Read: Yes    Replied: No
  3174.     To: Joe Kron                                     Mark:
  3175.   Subj: Text Input HELP!
  3176. ──────────────────────────────────────────────────────────────────────────────
  3177. JK> See PC Mag. 5-25-'93 pg. 299. This is one of many third party string
  3178. JK> input utilities. ANSWER is another in The Best of IBM PC Shareware
  3179. JK> that puts the string in an EVAR. There is also PC Mag's STRINGS
  3180. JK> which does this and more. But I must say the best answer is still
  3181. JK> 4DOS.
  3182.  
  3183.     Why go searching for a third and/or spending money when DOS provides
  3184.     the capability?
  3185.  
  3186.       @echo off
  3187.       :INPUT.BAT puts what is typed next in environment variable INPUT
  3188.        set input=
  3189.        echo INPUT.BAT
  3190.        echo Type in something and press [Enter]
  3191.        fc con nul /lb1 /n|date|find "    1:  ">temptemp.bat
  3192.        echo :Loop>>enter.bat
  3193.        echo if not (%%input%%)==() set input=%%input%% %%5>>enter.bat
  3194.        echo if (%%input%%)==() set input=%%5>>enter.bat
  3195.        echo shift>>enter.bat
  3196.        echo if not (%%5)==() goto Loop>>enter.bat
  3197.        for %%x in (call del) do %%x temptemp.bat
  3198.        del enter.bat
  3199.        echo The string you just entered:
  3200.        echo %input%
  3201.        echo has been stored in an environment variable named INPUT
  3202.       :End
  3203.  
  3204.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  3205. -!- Terminate 4.00
  3206.  ! Origin: Terminate point system (1:135/71.17)
  3207.  
  3208. ─ Area: Batch Language Programming                     FI ────────────────────
  3209.   Msg#: 430                                          Date: 07 May 96  19:02:00
  3210.   From: Jeff Brielmaier                              Read: Yes    Replied: No
  3211.     To: Osgar Schaedtler                             Mark:
  3212.   Subj: DETECT IF WINDOWS IS RUNN
  3213. ──────────────────────────────────────────────────────────────────────────────
  3214. OS>Is there a way to detect, in a batch file, if Windows is running?
  3215.  
  3216.    set|find "windir= >nul
  3217.    if errorlevel 1 goto NotRunning
  3218.    ....Windows is running....
  3219.  
  3220.  * KingQWK 1.05 # [PK] * DESQview vs. Windows is a no-Win situation.
  3221.  
  3222. -!- FLAME v1.1
  3223.  ! Origin: HAL-PC - (713)963-4100 (1:106/4100)
  3224.  
  3225. ─ Area: Batch Language Programming                     FI ────────────────────
  3226.   Msg#: 431                                          Date: 05 May 96  10:08:00
  3227.   From: Horst Schaeffer                              Read: Yes    Replied: No
  3228.     To: Vernon Frazee                                Mark:
  3229.   Subj: ERRORLEVEL
  3230. ──────────────────────────────────────────────────────────────────────────────
  3231. -=> quoting Vernon Frazee to Gary Smith (29 Apr 96) <=-
  3232.  
  3233. VF>     [....]
  3234. VF>     Applied the same technique to mine and it's now at 329 bytes:
  3235.  
  3236. VF>       @echo off
  3237. VF>       set F=for %%x in (
  3238. VF>       set E=errorlevel|%F%A B) do set %%x=0 1 2 3 4 5
  3239. VF>       [....]
  3240.  
  3241. Wow! But what shall I do with the rest of the 32Kb cluster?
  3242.  
  3243. Wouldn't it be more useful to have a routine that's simple and
  3244. easy to understand? For example:
  3245.  
  3246.  @echo off
  3247.  set !=
  3248.  for %%h in (0 1 2) do if errorlevel %%h00 set EL=%%h
  3249.  if not errorlevel 200 set !=6 7 8 9
  3250.  for %%t in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%t0 set EL=%EL%%%t
  3251.  if not errorlevel 250 set !=6 7 8 9
  3252.  for %%u in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%u set EL=%EL%%%u
  3253.  echo %EL%
  3254.  set !=
  3255.  set EL=
  3256.  
  3257. No fluff to save space ;-) ... and only 316 bytes.
  3258.  
  3259. VF>     ..... displays errorlevels with leading zeros, mine does not
  3260.  
  3261. Would require minor modifications (+24 bytes) - but I prefer to
  3262. leave it as simple as it is.
  3263.  
  3264. Horst.
  3265. ... Q4FM 2.10a ... horst@confusion.rmc.de
  3266.  
  3267. -!- FM 2.02 / ScanToss
  3268.  ! Origin: Don't follow leaders! (2:2480/13.75)
  3269.  
  3270. ─ Area: Batch Language Programming                     FI ────────────────────
  3271.   Msg#: 443                                          Date: 12 May 96  23:40:02
  3272.   From: Raphael Neve                                 Read: Yes    Replied: No
  3273.     To: John Medland                                 Mark:
  3274.   Subj: deleteing the undeletable dir
  3275. ──────────────────────────────────────────────────────────────────────────────
  3276. Following up a message from Malcolm Campbell to John Medland:
  3277.  
  3278.  JM=> I had this problem a year or so ago and it's come back to haunt
  3279.  JM=> me. Some one had given me a solution but I've lost the message
  3280.  JM=> now. The problem:
  3281.  JM=> A directory has been renamed using an illegal name.
  3282.  JM=> Dos can't delete or rename the dir. No programs can delete it
  3283.  JM=> either. It was named c:\max\cbv, but the name has been changed to
  3284.  JM=> c:\max\cbv    á. Anyone?
  3285.  
  3286. if you really want to get radical, you can always use a disk sector editor to
  3287. delete the file "by hand" :) seriously... all you have to do is:
  3288. a) load up your favourite sector editor
  3289. b) search for a distinguishing string (the directory name in question (CBV) or
  3290. any other file in the same directory... make sure you do all capitals
  3291. c) make sure you've got the right file / directory name
  3292. d) check again
  3293. e) kneel down in front of the computer and call upon the computer gods to
  3294. protect you
  3295. f) cross fingers and touch wood
  3296. g) replace the first character of the file or directory name by E5
  3297. h) make sure you don't change anthing else
  3298. h) save and quit
  3299.  
  3300. check you did it right by doing a dir. if you still see it and you're sure you
  3301. saved, then you've done something wrong and the results are unpredictable. if
  3302. you don't then you're well on your way to becoming a die-hard-disk-sector-
  3303. editor guru. then run scandisk to get rid of the lost clusters (ie all the
  3304. stuff that didn't get unlinked when you got rid of the directory or file
  3305. "manually")
  3306.  
  3307. note: kids, don't do this at home!!!
  3308.  
  3309. raph.
  3310.  
  3311. p.s. this is accurate: in a nutshell, dos recognises files that are deleted
  3312. from those that aren't by checking if the first character of a filename /
  3313. directory name is 'e5'. when you delete a file, all that happens is this
  3314. character gets written in the fat on top of the first character of the filename
  3315. (well, actually the associated clusters are freed too but that's nothing to do
  3316. with the fat). anyway... by writing this character in there yourself, you
  3317. effectively delete the file.
  3318.  
  3319. ... Buy Stacker?  Why not just delete Windows?
  3320. -!- FMail 0.96Γ
  3321.  ! Origin:  Canada Dry BBS - France * 3 lines on 47.29.33.85  (2:321/1)
  3322.  
  3323.  
  3324. ─ Area: Batch Language Programming                     FI ────────────────────
  3325.   Msg#: 435                                          Date: 14 May 96  20:15:46
  3326.   From: Vernon Frazee                                Read: Yes    Replied: No
  3327.     To: Larry Nelson                                 Mark:
  3328.   Subj: errorlevel
  3329. ──────────────────────────────────────────────────────────────────────────────
  3330. LN> Here's my 2 bits worth.
  3331. LN>
  3332. LN> ::ERR.BAT/DOS6.20
  3333. LN> :: Tested through errorlevel 26
  3334. LN> @echo off
  3335. LN> cls
  3336. LN> for %%h in (0 1 2) do if errorlevel %%h00 set L=%%h
  3337. LN> for %%t in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %L%%%t0 set L=%L%%%t
  3338. LN> for %%u in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %L%%%u set L=%L%%%u
  3339. LN> echo errorlevel=%L%
  3340. LN> set L=
  3341. LN> :L8r
  3342. LN>
  3343. LN> Less code, no temp files, 1 envar, and 280 bytes.
  3344. LN> :L8r
  3345.  
  3346.     A measly 7 more bytes and you get 'em all:
  3347.  
  3348.       @echo off
  3349.       set e=Errorlevel|set !=|set p=for %%t in (0 1 2
  3350.       %p%) do if %e% %%t00 set L=%%t
  3351.       if not %e% 200 set !=6 7 8 9
  3352.       %p%3 4 5 %!%) do if %e% %L%%%t0 set L=%L%%%t
  3353.       if not %e% 250 set !=6 7 8 9
  3354.       %p%3 4 5 %!%) do if %e% %L%%%t set L=%L%%%t
  3355.       set !=|set L=|set e=|set p=|echo %e%=%L%
  3356.  
  3357.     <g>
  3358. -!- Terminate 4.00
  3359.  ! Origin: Terminate point system (1:135/71.17)
  3360.  
  3361. ─ Area: Batch Language Programming                     FI ────────────────────
  3362.   Msg#: 441             Rec'd                        Date: 22 May 96  18:04:53
  3363.   From: Vernon Frazee                                Read: Yes    Replied: No
  3364.     To: Bat Lang                                     Mark:
  3365.   Subj: FOR/DO...  Clean and Conc
  3366. ──────────────────────────────────────────────────────────────────────────────
  3367. VF>   for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  3368. VF> If you'll watch DOS process this line, you can see it doing
  3369. VF> exactly the same thing as the above four individual lines
  3370. VF>   SET TEMP=C:\TEMP
  3371. VF>   SET TMP=C:\TEMP
  3372. VF>   SET LIST=C:\TEMP
  3373. VF>   SET AHDTMP=C:\TEMP
  3374.  
  3375. BL> Which is faster in execution, your first quoted line, or?:
  3376. BL> SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  3377.  
  3378.     To slow them down enough to be able to even time them, I did 10
  3379.     iterations of each.  IOW,
  3380.  
  3381.     @echo off
  3382.     :FORINDO.BAT
  3383.     for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  3384.     for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  3385.     for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  3386.     ... 10 of these for-in-do's ...
  3387.  
  3388.     @echo off
  3389.     :SET-EACH.BAT
  3390.     SET TEMP=C:\TEMP
  3391.     SET TMP=C:\TEMP
  3392.     SET LIST=C:\TEMP
  3393.     SET AHDTMP=C:\TEMP
  3394.     set temp=c:\temp
  3395.     set tmp=c:\temp
  3396.     set list=c:\temp
  3397.     set ahdtmp=c:\temp
  3398.     SET TEMP=C:\TEMP
  3399.     SET TMP=C:\TEMP
  3400.     SET LIST=C:\TEMP
  3401.     SET AHDTMP=C:\TEMP
  3402.     ... 10 sets of these groups of four ...
  3403.  
  3404.     @echo off
  3405.     :ALLON1.BAT
  3406.     SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  3407.     SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  3408.     SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  3409.     ... 10 of these lines ...
  3410.  
  3411.  
  3412.     I then ran each 10 times and averaged the elapsed times.  Results:
  3413.  
  3414.       BATch file    Elapsed Time
  3415.       ------------  -------------
  3416.       FORINDO.BAT    1:59 seconds
  3417.       SET-EACH.BAT   1:37 seconds
  3418.       ALLON1.BAT    10:99 seconds
  3419.  
  3420.     Yep, I couldn't believe it either. <G>
  3421.  
  3422.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  3423. -!- Terminate 4.00
  3424.  ! Origin: Terminate point system (1:135/71.17)
  3425.  
  3426. ─ Area: Batch Language Programming                     FI ────────────────────
  3427.   Msg#: 419                                          Date: 23 May 96  16:49:56
  3428.   From: Vernon Frazee                                Read: Yes    Replied: No
  3429.     To: Jesse Block                                  Mark:
  3430.   Subj: Bat Needed!
  3431. ──────────────────────────────────────────────────────────────────────────────
  3432. JB> The other day, we were tring to make a Batch file that would comb
  3433. JB> through an ASCII file and pullout all the web address, then, put
  3434. JB> them into another ASCII file called NET.TXT.    We found this could
  3435. JB> do it from MS_DOS 6.22:
  3436. JB>
  3437. JB>   for %f in (*.txt) do find "http:" %f > net.txt
  3438. JB>
  3439. JB> but for some reason, we couldn't use this in a batch file.  It kept
  3440. JB> coming back "syntax error" but it worked fine from a dos prompt. So,
  3441. JB> here's my problem:
  3442. JB>
  3443. JB> 1. Can this be done as a batch file in a different way?
  3444. JB>
  3445. JB> 2. What did I do wrong that _this_ wouldn't work?
  3446.  
  3447.     DOS strips one of the percent signs when for-in-do is being used in
  3448.     a BATch file.  Therefore, if you'll change both occurances of "%f"
  3449.     to "%%f" it should work just fine.
  3450.  
  3451.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  3452. -!- Terminate 4.00/Pro
  3453.  ! Origin: Terminate point system (1:135/71.17)
  3454.  
  3455. ─ Area: Batch Language Programming                     FI ────────────────────
  3456.   Msg#: 407                                          Date: 23 May 96  10:24:40
  3457.   From: Richard Epling                               Read: Yes    Replied: No
  3458.     To: Alan Milewczyk                               Mark:
  3459.   Subj: Capturing date in a batch
  3460. ──────────────────────────────────────────────────────────────────────────────
  3461.     From: Alan Milewczyk                       Time: 05-19-96 13:30:30
  3462. > I want to be able to capture today's date into a batch file to enable
  3463. > me to copy files in a specific directory with the attribute flag set.
  3464. > How do I capture the date and pass it over to the copy file routine.
  3465.  
  3466. I don't understand how you would use the date to copy the files but I'm
  3467. assuming you do. One way you could do this would be to get the output of a
  3468. DATE command into a temporary batch file which you could then use to run
  3469. another batch file to do what you want to do. For example;
  3470.  
  3471. @ECHO OFF
  3472. ECHO.|DATE|FIND /I "CURRENT">TEMP.BAT
  3473.  
  3474. That will put the line "Current date is Thu 05-23-1996" into TEMP.BAT.
  3475. You can then either have a batch file name CURRENT.BAT to do the work, and
  3476. CALL TEMP.BAT or ECHO the commands you want to CURRENT.BAT. For example to
  3477. set an environment variable with the current date you could continue the
  3478. above example with these lines;
  3479.  
  3480. ECHO SET D8=%%4>CURRENT.BAT
  3481. CALL TEMP.BAT
  3482.  
  3483. That will give you an environment variable you might be able to use in your
  3484. other batch command. Note the double percent sign is required here. The
  3485. contents of CURRENT.BAT would be "SET D8=%4." CALLing TEMP.BAT would cause it
  3486. to run CURRENT.BAT which would set the variable for you. Hope this is what you
  3487. need.
  3488.  
  3489. Richard
  3490. -!- FreeMail 1.09
  3491.  ! Origin: Electric Eye-28.8 Sacramento,CA(916)441-5465    (1:203/65)
  3492.  
  3493.  
  3494. ─ Area: Batch Language Programming                     FI ────────────────────
  3495.   Msg#: 449                                          Date: 27 May 96  00:00:00
  3496.   From: Mike Zeleski                                 Read: Yes    Replied: No
  3497.     To: Robin Chapple                                Mark:
  3498.   Subj: Where To Start?
  3499. ──────────────────────────────────────────────────────────────────────────────
  3500. RC>Greetings To All!
  3501.  
  3502. RC>         I'm wanting to learn more about batch file programming.
  3503. RC>         Where does a 'know nothing' start?
  3504.  
  3505. With the basics...  :-}
  3506.  
  3507. RC>Is there a file I can download?
  3508.  
  3509. Several, notably you should look for MUF17, and any one of several Batch
  3510. programming tutorial that exist on the Nets...
  3511.  
  3512. RC>Is there a good book that I can buy?
  3513.  
  3514. Several, however you should already have a good one already...
  3515.  
  3516. Your Dos Manual, and the Dos Help program.  While they are not
  3517. particularly batch specific, they will help a lot.
  3518.  
  3519. The other features of BFP are not all that bad to master.
  3520. Excluding ordinary Dos commands, BFP just adds a few instructions,
  3521. labels, and variables to the mix...
  3522.  
  3523. Lets see...
  3524. %1-%9 are handled much like Dos command line variables,
  3525. There is a IF (?) command, Labels to go to, and several other bits...
  3526.  
  3527. See below for a few examples.  This little bit is notoriously short on
  3528. how to's beyond the vary basic minimums, but frankly let's discuss them
  3529. later when you have specific questions to ask...
  3530.  
  3531. [Start Mike's BFP MiniFaq.]
  3532.  
  3533. Batch file program is based on the simple conjecture that it is easy to
  3534. create a user readable text file program/utility that simply stacks Dos
  3535. commands together with just a few special BFP commands to do actions
  3536. like move a file or create a directory and move to it without having to
  3537. create a program to do so from scratch...
  3538.  
  3539. This can be a simple way to automate anything that you do more than
  3540. once. With a few external Batch programming aids, the use of command
  3541. line variables, internal variables, Qbasic calls, stacked commands,
  3542. errorlevel jumps, Labels, and Goto's these "little" programs can get
  3543. quite sophisticated and complicated in a hurry.
  3544.  
  3545. However BFP is best when kept to the basics for most mundane everyday
  3546. uses, as in good engineering KISS is the word.  As a tip I often use a
  3547. little batch file that dumps doskey's remembered commands into a little
  3548. batch file and immediately edit it like so.
  3549.  
  3550. Qckbat.bat (Use D:\path\xxxxxxxx.bat CM parameter)
  3551.  
  3552. DOSKEY /HISTORY > %1
  3553. EDIT %1
  3554.  
  3555. This little example dumps past instructions into a batch file and
  3556. immediately sends you into edit to make some small changes to that
  3557. batch file. (You must have doskey loaded to make this work.)
  3558.  
  3559. I also used a Batchfile program to present a nice menu with ansi.sys
  3560. commands and a external utility to run my most frequently used programs
  3561. from. I did this to even run some Windows programs or plain Windows by
  3562. itself. Did you know that you can start Windows and run a Windows program
  3563. immediately from the commandline...
  3564.  
  3565. In fact here are a few clips from that menu, (If you want the entire
  3566. thing including the utility I used to use, Netmail me.) One of the
  3567. below clips includes the most efficient defrag command line I know of.
  3568. It's only a few percent better than a simple consolidation, but what the
  3569. hay, you might as well do it right...
  3570.  
  3571. [quote mode on.]
  3572.  
  3573. :run_defr
  3574. C:\d\defrag C: /F /S:E
  3575. goto restart2
  3576.  
  3577. :run_qmdm
  3578. win c:\qmpw\qmwin qmwin.phn 1
  3579. rem This little string starts Windows, my old Q-modem terminal program,
  3580. rem calls my main bbs mail #, and it's attached script.  Mail run.
  3581. rem Automation! 3 command line parameters for two different programs.
  3582. goto restart
  3583.  
  3584. :winstart
  3585. win
  3586. rem Run Windows.
  3587. goto restart
  3588.  
  3589. :wp_60
  3590. win C:\wp60\wp
  3591. rem Same as above with Word Perfect 6 for windows.
  3592. goto restart
  3593.  
  3594. :win_word
  3595. win C:\winword\winword.exe
  3596. Rem Yes, I do Microsoft apps. But you should hear the wave file attached
  3597. rem to this program's start up it. Ahooga.wav
  3598. goto restart
  3599.  
  3600. :Gramtx_5
  3601. Win: c:\gmkw\gmkw.exe
  3602. rem sometimes we use bad english, don't we...
  3603. goto restart
  3604.  
  3605. [quote mode off.]
  3606.  
  3607. Some other useful examples...
  3608.  
  3609. MDCD.BAT (Use xxxxxxxxxxx directory name CM param.)
  3610.  
  3611. MD %1
  3612. CD %1
  3613.  
  3614. This little BFP creates the directory and moves you directly into the
  3615. directory that it just created.  Use just like you would use both MD &
  3616. CD, but it combines them into just one command...
  3617.  
  3618. Header.bat (Use D:\path\xxxxxxxx.txt CM parameter.)
  3619.  
  3620. @Echo (One line of text here) > JUNK.txt
  3621. copy JUNK.TXT + %1 %1
  3622. del junk.txt
  3623.  
  3624. This little installs adds one line of prespeficified text into the
  3625. beginning of every file indicated as the commandline parameter.
  3626.  
  3627. If you want to add more than one line then you do it this way...
  3628.  
  3629. Header.bat (Use D:\path\xxxxxxxx.txt CM parameter.)
  3630.  
  3631. @Echo (One line of text here) > JUNK.txt
  3632. @Echo (Next line of text here) >> JUNK.txt
  3633. Rem Repeat the echo as many times as needed.
  3634. rem One arrow means make the file, two means add to it, aka append.
  3635. copy JUNK.TXT + %1 %1
  3636. del junk.txt
  3637.  
  3638. Trailer.bat
  3639.  
  3640. @Echo (One line of text here) > JUNK.txt
  3641. @Echo (Next line of text here) >> JUNK.txt
  3642. Rem Repeat the echo as many times as needed.
  3643. rem One arrow means make or overwrite the file, two means add to it, aka
  3644. rem append.
  3645. copy %1 + JUNK.TXT %1
  3646. del junk.txt
  3647.  
  3648. There are some good BFP FAQ/tutorial files floating around out on the
  3649. BBS's, as is the excellent MUF 1.7 file. I suggest you grab them...
  3650.  
  3651.  
  3652.  
  3653. -!-
  3654.  * OLXWin 1.00b * Always tell her she's beautiful, especially if she isn't. RAH
  3655.  
  3656. -!- WILDMAIL!/WC v4.12
  3657.  ! Origin: Father & Son*610-439-1509*Whitehall Pa  (1:2607/112.0)
  3658.  
  3659. ─ Area: Batch Language Programming                     FI ────────────────────
  3660.   Msg#: 438                                          Date: 30 May 96  09:04:27
  3661.   From: Vernon Frazee                                Read: Yes    Replied: No
  3662.     To: Larry Nelson                                 Mark:
  3663.   Subj: Errlevel.exe
  3664. ──────────────────────────────────────────────────────────────────────────────
  3665. VF> I almost sent you the following little ERRLEVEL.COM (& .DOC) in my
  3666. VF> last message to you.  It sticks whatever errorlevel you want in
  3667. VF> memory so you can then test for it with your BATch file.
  3668. VF> ----------------------------->CUT HERE<-----------------------------
  3669. VF> NERRLEVEL.ZIP
  3670.  
  3671. LN> TKS, Rat.com worked but it was a long way around. Am now waiting for
  3672. LN> the sh*t storm when these guys discover that we might actualy stoop
  3673. LN> to extraDOS utilities on the odd occation.
  3674.  
  3675.     <g>
  3676.  
  3677. LN> Has any body actualy found where in memory the errorlevel data is
  3678. LN> stored?
  3679.  
  3680.     Here, try this -- stick an exit code in memory that can then be
  3681.     tested for with one of the EL.BAT files floating around:
  3682.  
  3683.     1) Put what's in this     Everything in this column
  3684.        column into a file     is merely a comment and
  3685.        named GETKEY.SCR:      should not be in the file
  3686.        ------------------     ----------------------------
  3687.        N GETKEY.COM           Filename will be GETKEY.COM
  3688.        A                      Toggle into assembler mode
  3689.        MOV AH,00              BIOS read a character and
  3690.        INT 16                 put its ASCII code into AL
  3691.        MOV AH,4C              Ready to exit with code so
  3692.        INT 21                 do it
  3693.                               Toggle out of assembler mode
  3694.        RCX                    Read register CX and
  3695.        8                      stuff file size into it
  3696.        W                      Write the file to disk
  3697.        Q                      Quit DEBUG
  3698.  
  3699.     (Note: Make sure you leave the blank line between "INT 21" and "RCX"
  3700.     to toggle DEBUG back out of the assembler mode).
  3701.  
  3702.     2) Create the program GETKEY.COM by typing:
  3703.  
  3704.          DEBUG<GETKEY.SCR
  3705.  
  3706.     3) To test it type:
  3707.  
  3708.          GETKEY|EL
  3709.  
  3710.        and then press say the [Esc] key.  You should get an errorlevel
  3711.        of 27 -- the ASCII code for the Escape character.  Now try it by
  3712.        pressing say [Shift-A] (uppercase A) and you should get an
  3713.        errorlevel of 65.  Lowercase "A" would be 97, etc., etc., etc.
  3714.  
  3715.        Or, you could even use it in a BATch file that would only exit to
  3716.        DOS if you pressed say the [Enter] key (ASCII 13):
  3717.  
  3718.          @echo off
  3719.           echo Press the [Enter] key to exit to DOS
  3720.          :Loop
  3721.           getkey
  3722.           if errorlevel 13 if not errorlevel 14 goto End
  3723.           goto Loop
  3724.          :End
  3725.  
  3726.     (Note: Both DOS and your system's BIOS can process keystrokes.  This
  3727.     particular example uses the BIOS but it's just as easy to substitute
  3728.     a DOS function call.  In fact, DOS is better for some things because
  3729.     it offers several options.  It can display the character you entered
  3730.     or discard it, wait for a keystroke or process one only if it's
  3731.     there waiting, and it can handle break attempts or ignore them).
  3732.  
  3733.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  3734. -!- Terminate 4.00/Pro
  3735.  ! Origin: Terminate point system (1:135/71.17)
  3736.  
  3737. ─ Area: Batch Language Programming                     FI ────────────────────
  3738.   Msg#: 439                                          Date: 30 May 96  14:27:00
  3739.   From: Roy Reed                                     Read: Yes    Replied: No
  3740.     To: All                                          Mark:
  3741.   Subj: filenames with numerical extensions
  3742. ──────────────────────────────────────────────────────────────────────────────
  3743. If anybody has a series of files with all digit extensions, I
  3744. made the following two batch files to enable switching back
  3745. and forth between having or stripping leading zeroes in their
  3746. extensions (i.e., renaming the files by changing the extension).
  3747. These batch file names may be called whatever_you_want.bat
  3748.  
  3749. Rejoin word-wrapped command sentences at the dollar signs, then
  3750. delete the dollar signs.(Two sets per file)
  3751. ------------------------------------------------
  3752. ::lead000.bat
  3753. @echo off
  3754. if "%1"=="pancakedough" goto pancakedough
  3755. if "%1"=="" goto syntax
  3756. set fn=%1
  3757. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  3758.             $$$ %fn%.%%x ren %fn%.%%x %fn%.00%%x
  3759. for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 pancakedough %%x
  3760. goto end
  3761. :pancakedough
  3762. set k=%2
  3763. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  3764.     $$$ %fn%.%k%%%x ren %fn%.%k%%%x %fn%.0%k%%%x
  3765. goto end
  3766. :syntax
  3767. echo enter lead000 file_basename
  3768. :end
  3769. set k=
  3770. ------------------------------------------------
  3771.  
  3772. ------------------------------------------------
  3773. ::nolead0.bat
  3774. @echo off
  3775. if "%1"=="pancakedough" goto pancakedough
  3776. if "%1"=="" goto syntax
  3777. set fn=%1
  3778. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  3779.           $$$ %fn%.00%%x ren %fn%.00%%x %fn%.%%x
  3780. for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 pancakedough %%x
  3781. goto end
  3782. :pancakedough
  3783. set k=%2
  3784. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  3785.    $$$ %fn%.0%k%%%x ren %fn%.0%k%%%x %fn%.%k%%%x
  3786. goto end
  3787. :syntax
  3788. echo enter nolead0 file_basename
  3789. :end
  3790. set k=
  3791. ------------------------------------------------
  3792. For example, if you have file.1 through file.25, entering
  3793. a command of lead000 file will leave you with file.001
  3794. through file.025.  To put them back to original names,
  3795. enter nolead0 file
  3796.  
  3797.    Roy
  3798.  ! Origin: The GIFfer BBS, 75+gig, (813)969-2761 (1:377/50)
  3799.  
  3800.  
  3801.                                 TOP
  3802. ##############################################################################
  3803. ─ Area: Batch Language Programming                     FI ────────────────────
  3804.   Msg#: 423                                          Date: 27 Feb 96  23:40:00
  3805.   From: Vernon Frazee                                Read: Yes    Replied: No
  3806.     To: Furlan Primus                                Mark:
  3807.   Subj: L-O-N-G PATH          1/2
  3808. ──────────────────────────────────────────────────────────────────────────────
  3809. VF> BTW, I have shown more than a few folks how a PATH of up to at least
  3810. VF> 4,096 bytes (yep, that's four-thousand-and-ninety-six characters)
  3811. VF> can be created and successfully used... using nothing more than DOS.
  3812.  
  3813. FP> i have always kept my PATH to the mininum needed as a matter of
  3814. FP> choice
  3815.  
  3816.     Same on this end (it's faster).
  3817.  
  3818. FP> and just exactly HOW do you do the above anyway???
  3819.  
  3820.     --------------------------------------------------------------------
  3821.     L-o-n-g PATH "how to" for MS-DOS version 6.nn (any version of DOS 6)
  3822.     --------------------------------------------------------------------
  3823.  
  3824.     Normally, on most MS-DOS v6.xx systems, when the system boots it
  3825.     looks for and loads/runs the following five files -- in this order:
  3826.  
  3827.       1) IO.SYS       - basic Input/Output routines
  3828.       2) MSDOS.SYS    - basic MicroSoft Disk Operating System routines
  3829.       3) CONFIG.SYS   - user created ASCII file (drivers, etc.)
  3830.       4) COMMAND.COM  - command line processor
  3831.       5) AUTOEXEC.BAT - user created ASCII file (whatever)
  3832.  
  3833.     The 4th step, loading COMMAND.COM, is what limits the command line,
  3834.     and hence the "PATH=..." line length in AUTOEXEC.BAT, to a maximum
  3835.     of 127 characters.
  3836.  
  3837.     The 'secret' to creating a l-o-n-g PATH then is to set it up in
  3838.     CONFIG.SYS -- before COMMAND.COM's 127 character line limit has
  3839.     come in to play -- instead of in AUTOEXEC.BAT.
  3840.  
  3841.     Setting up a PATH in CONFIG.SYS only works, (I believe), in MS-DOS
  3842.     v6.xx or higher and uses the following syntax:
  3843.  
  3844.       SET PATH=drive:\directory[;drive:\directory][;...]
  3845.  
  3846.     Tip: All of the following examples will NOT work in CONFIG.SYS like
  3847.          they do in AUTOEXEC.BAT:
  3848.  
  3849.            PATH=...     PATH=%PATH%;...     SET PATH=%PATH%;...
  3850.            PATH ...     PATH %PATH%;...     SET PATH %PATH%;...
  3851.  
  3852.          In other words, if the line doesn't begin with "SET PATH=", DOS
  3853.          will return something like "Error in CONFIG.SYS line 1".
  3854.  
  3855.          The %PATH% idea also fails because the program that defines and
  3856.          understands such, COMMAND.COM, has not been loaded yet.
  3857.  
  3858.     PATH lengths of up to a whopping 4,096 characters have been tested
  3859.     here, with success, using this "CONFIG.SYS" "SET PATH=..." approach.
  3860.  
  3861.     --------------------------------------------------------------------
  3862.                 [ ... text deleted for brevity ... ]
  3863.  
  3864. -!-
  3865.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  3866.  
  3867.  
  3868. ─ Area: Batch Language Programming                     FI ────────────────────
  3869.   Msg#: 431                                          Date: 04 Mar 96  13:28:05
  3870.   From: Vernon Frazee                                Read: Yes    Replied: No
  3871.     To: Carlo Mosti                                  Mark:
  3872.   Subj: Daily execution
  3873. ──────────────────────────────────────────────────────────────────────────────
  3874. CM> I would like to know if someone knows of a way to resolve my problem
  3875. CM> by using only batchfile commands. I want to execute a program
  3876. CM> everyday but only once! How do I control that?
  3877.  
  3878.     Here's one that does it by storing the command you entered plus the
  3879.     current system date on one line at the end of the BATch file itself.
  3880.     When you launch it again it simply looks for an identical command-
  3881.     line/date.  (If one is found it tells you that command has already
  3882.     been run today.  If no match is found, it adds the command and date
  3883.     to the end of the file and continues).
  3884.  
  3885.     Note: Because this is a self-modifying BATch file, you may need to
  3886.           change all occurances of "C:\BAT" to the location of where you
  3887.           intend on keeping it on your hard drive.
  3888.  
  3889. @echo off
  3890. :ONCEADAY.BAT runs a specified program once-a-day only -----------------
  3891. :Notes: This BATch file is self modifying!  It keeps track of every date
  3892. :       and the command(s) issued on that date at end of this file.
  3893. :       Requires DOS's FIND (somewhere in current PATH is fine).
  3894. :       Use "CURRENT /C" (not the quotes) to clear all dates from file.
  3895. :-----------------------------------------------------------------------
  3896.  if (%1%2)==(dateis) goto GOTIT
  3897.  if (%1)==(/?) goto SYNTAX
  3898.  if (%1)==() goto SYNTAX
  3899.  for %%x in (:) do set colons=%%x%%x
  3900.  for %%x in (c C) do if (%1)==(/%%x) goto CLEAR
  3901.  set program=%1 %2 %3 %4
  3902.  ver|date>temptemp.bat
  3903.  echo %0 %%1 %%2 %%3 %%4>current.bat
  3904.  temptemp
  3905. :GOTIT -----------------------------------------------------------------
  3906.  set date=%4
  3907.  find /c "%colons%%4%program%" C:\BAT\%0.BAT>temptemp.bat
  3908.  echo set current=%%2>--------.bat
  3909.  call temptemp.bat
  3910.  if (%current%)==(0) echo %colons%%date%%program%>>C:\BAT\%0.BAT
  3911.  if (%current%)==(0) goto DO_IT
  3912.  echo Command: %program%
  3913.  echo          has already been run today.
  3914.  goto CLEANUP
  3915. :DO_IT -----------------------------------------------------------------
  3916.  cls
  3917.  echo Issuing command: %program% ...
  3918.  echo.
  3919.  call %program%
  3920.  goto CLEANUP
  3921. :CLEAR -----------------------------------------------------------------
  3922.  type C:\BAT\%0.BAT|find /v "%colons%">C:\BAT\%0.BAT
  3923. :CLEANUP ---------------------------------------------------------------
  3924.  for %%x in (-------- temptemp current) do if exist %%x.bat del %%x.bat
  3925.  for %%x in (program colons current date) do set %%x=
  3926.  goto END
  3927. :SYNTAX ----------------------------------------------------------------
  3928.  cls
  3929.  echo.
  3930.  echo    Name: ONCEADAY.BAT
  3931.  echo.
  3932.  echo  Author: Vernon Frazee 03/03/94
  3933.  echo.
  3934.  echo Purpose: Run specified command only once a day.
  3935.  echo.
  3936.  echo  Syntax: ONCEADAY program_name/command [parm_1] [parm_2] [parm_3]
  3937.  echo.
  3938.  echo          ONCEADAY /C  clears all entries
  3939.  echo.
  3940.  echo          ONCEADAY /?  displays this help
  3941.  echo.
  3942.  echo Example: ONCEADAY DEFRAG C: /F /SN
  3943.  echo.
  3944.  echo   Notes: Requires DOS's FIND (must be available in current PATH)
  3945.  echo.
  3946.  echo          Requires at least approx 50 bytes free environment space
  3947.  echo.
  3948.  echo          ONCEADAY.BAT is self modifying!  (It keeps track of when
  3949.  echo                       and what was run at the end of the file).
  3950.  echo.
  3951.  goto END
  3952. :END (Data storage begins below) --------------------------------- -vjf-
  3953.  
  3954.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  3955.  
  3956. -!- OLMS 2.53p+ [ERSBN55C]
  3957.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  3958.  
  3959. ─ Area: Batch Language Programming                     FI ────────────────────
  3960.   Msg#: 390                                          Date: 04 Mar 96  21:52:00
  3961.   From: Roy Reed                                     Read: Yes    Replied: No
  3962.     To: All                                          Mark:
  3963.   Subj: Counting file lines
  3964. ──────────────────────────────────────────────────────────────────────────────
  3965.  LD>> I want this batch to make a list of %1 <EG: *.bat or *.txt>
  3966.  
  3967.  LD>> then use the list to count the lines in each found
  3968.  
  3969.  LD>> then report to some file, the found file name(s) and the # of
  3970. lines
  3971.  LD>> EG: somefile.txt 27
  3972.  
  3973.  LD>>     othrfile.txt 13
  3974.  
  3975.  LD>>     yetnothr.txt 29
  3976.  
  3977.  
  3978.  
  3979. I used SORT and FIND from DOS, and Michael Mefford's CHANGE.COM in the
  3980. following batch file to group extension_requested files of the current
  3981. directory in a list and count their lines.
  3982.  
  3983. After running this file 12 times, you'll get a file creation error on
  3984. the 13th run.  Anybody know why?  Something with the FIND command
  3985. or FOR IN DO or CALL?  My el cheapo 486?
  3986. If I change the do find in the for-in-do to do call find, it bombs on
  3987. the 9th try.
  3988.  
  3989. REM countext.bat
  3990. @echo off
  3991. if "%1"== "" goto syntax
  3992. set fn=-%1
  3993. if exist $!&)list del $!&)list
  3994. for %%x in (*.%1) do find /c /v "<^>#~" %%x >>$!&)list
  3995. call change $!&)list 13,10,45,45,45,45,45,45,45,45,45,45 "" > nul
  3996. call change $!&)list ":" "" > nul
  3997. call sort < $!&)list > %fn%list
  3998. del $!&)list
  3999. set fn=
  4000. goto end
  4001. :syntax
  4002. echo.
  4003. echo enter  countext ext  of filenames you want linecounts of
  4004. echo example - countext txt, or countext doc, or countext bat, etc.
  4005. echo filenames and linecounts will be in file -extlist
  4006. :end
  4007. ::---------------RCR--------------
  4008.                            Part 1
  4009.  
  4010. -!- PCBoard (R) v15.22 (OS/2) 10
  4011.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  4012.  
  4013. ─ Area: Batch Language Programming                     FI ────────────────────
  4014.   Msg#: 391                                          Date: 04 Mar 96  21:54:00
  4015.   From: Roy Reed                                     Read: Yes    Replied: No
  4016.     To: All                                          Mark:
  4017.   Subj: Counting file lines
  4018. ──────────────────────────────────────────────────────────────────────────────
  4019. Here is another version named extcount.bat using PREFIX.COM
  4020. from DOSWORLD magazine.
  4021.  
  4022. @echo off
  4023. if not "%4"== "" goto wrapitup
  4024. if "%1"== "almost_done" goto shrink
  4025. if "%1"== "" goto syntax
  4026. set fn=-%1
  4027. if exist $!&)list.bat del $!&)list.bat
  4028. if exist %fn%list del %fn%list
  4029. for %%x in (*.%1) do call %0 almost_done %%x
  4030. call sort < %fn%list > po-trait
  4031. del %fn%list
  4032. ren po-trait %fn%list
  4033. for %%y in (fn name) do set %%y=
  4034. goto end
  4035. :wrapitup
  4036. echo %name% %4 >> %fn%list
  4037. if exist $!&)list.bat del $!&)list.bat
  4038. goto end
  4039. :shrink
  4040. set name=%2
  4041. echo. | find /c /v "<^>#~" %name% | find "----------" | ...
  4042. ... prefix extcount plop >>$!&)list.bat
  4043. call $!&)list
  4044. goto end
  4045. :syntax
  4046. echo enter extcount and extension of files you want individual count of
  4047. :end
  4048. ::---------------RCR--------------
  4049.  
  4050. In extcount.bat, assemble the two lines with ... together at that point
  4051.  
  4052. Here is the PREFIX.SCR to DEBUG < PREFIX.SCR to obtain prefix.com
  4053.  
  4054. N PREFIX.COM
  4055. A
  4056. PUSH CS
  4057. POP DS
  4058. MOV DX,0157
  4059. MOV [0155],DX
  4060. MOV AH,3F
  4061. MOV BX,0000
  4062. MOV CX,0001
  4063. MOV DX,[0155]
  4064. INC WORD PTR [0155]
  4065. INT 21
  4066. CMP AX,0000
  4067. JNZ 0125
  4068. MOV AX,4C00
  4069. INT 21
  4070. PUSH DX
  4071. POP SI
  4072. MOV AH,[SI]
  4073. CMP AH,0A
  4074. JZ 0130
  4075. JMP 0109
  4076. PUSH AX
  4077. MOV BX,0001
  4078. XOR CH,CH
  4079. MOV CL,[0080]
  4080. MOV DX,0081
  4081. MOV AH,40
  4082. INT 21
  4083. MOV AH,40
  4084. MOV BX,0001
  4085. MOV CX,[0155]
  4086. SUB CX,0157
  4087. MOV DX,0157
  4088. INT 21
  4089. JMP 0102
  4090.  
  4091. RCX
  4092. 155
  4093. W
  4094. Q
  4095.  
  4096. Try, for example; DIR |prefix put me first >> zzz
  4097.                               Part 2
  4098.  
  4099. -!- PCBoard (R) v15.22 (OS/2) 10
  4100.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  4101.  
  4102. ─ Area: Batch Language Programming                     FI ────────────────────
  4103.   Msg#: 392                                          Date: 04 Mar 96  21:55:00
  4104.   From: Roy Reed                                     Read: Yes    Replied: No
  4105.     To: All                                          Mark:
  4106.   Subj: COUNTING FILE LINES
  4107. ──────────────────────────────────────────────────────────────────────────────
  4108. This will count the lines in one file.  Submitted to see how badly
  4109. Vernon Frazee will "in my face" me with his faster two-liner.  But
  4110. I do honor the king.
  4111.  
  4112. @echo off
  4113. if "%2"=="felines" goto felines
  4114. if "%1"=="" goto namepls
  4115. set fn=%1
  4116. find /c /v "<^>#~" %1 > (^^--^^).bat
  4117. call change (^^--^^).bat 13,10,45,45,45,45,45,45,45,45,45,45 "felines
  4118. felines felines" > nul
  4119. echo.
  4120. (^^--^^) > nul
  4121. :felines
  4122. echo file %fn% has %4 lines
  4123. goto end
  4124. :namepls
  4125. echo proper syntax is felines filename
  4126. echo this finds # of lines in named file
  4127. :end
  4128.  set fn=
  4129. del (^^--^^).bat
  4130.  
  4131. -!- PCBoard (R) v15.22 (OS/2) 10
  4132.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  4133.  
  4134. ─ Area: Batch Language Programming                     FI ────────────────────
  4135.   Msg#: 424                                          Date: 05 Mar 96  09:17:01
  4136.   From: Vernon Frazee                                Read: Yes    Replied: No
  4137.     To: Stephan Hoppe                                Mark:
  4138.   Subj: Get date?
  4139. ──────────────────────────────────────────────────────────────────────────────
  4140. SH> What I'd like to do is have a plain vanilla batch file that grabs
  4141. SH> the day of the month so that on the 3rd, for example, I could defrag
  4142. SH> my HD, on the 4th run scandisk, etc. etc.
  4143. SH> I figure it would have to be something that grabs the day of the
  4144. SH> month as an env variable then the calling batch files would check
  4145. SH> this to see if its the right day.
  4146. SH> How to grab the variable?
  4147. SH> Please no 4dos, ndos or whatever. . .just MS-DOS.
  4148.  
  4149.     Here's one way to get the current system Month, Day, and Year, into
  4150.     separate environment variables (evars) using DOS's CHOICE.COM.
  4151.  
  4152.       @echo off
  4153.       :---------------------------------------------------
  4154.       :    Name: MDY.BAT - For US DATE format (mm-dd-yyyy)
  4155.       : Purpose: Using current system date, put 2-digit
  4156.       :          month in evar MM, 2-digit day in evar DD,
  4157.       :          and 2-digit year in evar YY.
  4158.       :Requires: CHOICE.COM and 36 bytes in environment.
  4159.       :---------------------------------------------------
  4160.        if (%1)==(![) goto ParseIt
  4161.        for %%x in (mm dd yy mdy) do set %%x=
  4162.        >~tmp~.bat ver|date
  4163.        echo set mdy=%%4>current.bat
  4164.        for %%x in (call del) do %%x ~tmp~.bat
  4165.        del current.bat
  4166.        >~tmp~.bat echo;;|choice/c:;%mdy%; "%0 !"
  4167.        ~tmp~.bat
  4168.       :ParseIt -------------------------------------------
  4169.        set mm=%2%3|set dd=%5%6
  4170.        shift|shift
  4171.        set yy=%8%9|echo MM=%mm%
  4172.        echo DD=%dd%
  4173.        echo YY=%yy%
  4174.        del ~tmp~.bat|set mdy=
  4175.       :End ----------------------------------------- -vjf-
  4176.  
  4177.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4178.  
  4179. -!- OLMS 2.53p+ [ERSBN55C]
  4180.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4181.  
  4182. ─ Area: Batch Language Programming                     FI ────────────────────
  4183.   Msg#: 428                                          Date: 05 Mar 96  03:38:00
  4184.   From: Vernon Frazee                                Read: Yes    Replied: No
  4185.     To: Richard Dale                                 Mark:
  4186.   Subj: Humongous project
  4187. ──────────────────────────────────────────────────────────────────────────────
  4188. RD> M:\USERS\74801000>fwcopy 74801000 phone.001
  4189.  
  4190. VF> The enclosed examples should help you get started
  4191.  
  4192. RD> I thank you very kindly! I shall let you know on the results.
  4193.  
  4194.     You're more than welcome, and yes, please do.
  4195.  
  4196. RD> FWIW, "fwcopy" copies the files over to be used by the Ft. Worth
  4197. RD> office, hence "fw".  The command that is *really* supposed to be
  4198. RD> used is CLEAN 74801000 PHONE.001, but if I mess up and clean
  4199. RD> PHONE.001 again within 5 minutes or so, it can crash or slow down
  4200. RD> the system.  Sheesh!<tm>.
  4201.  
  4202.     The following might help solve that particular problem.  It only
  4203.     allows the exact same command to be run once per day.
  4204.  
  4205. @echo off
  4206. :ONCEADAY.BAT runs a specified program once-a-day only -----------------
  4207. :Notes: This BATch file is self modifying!  It keeps track of every date
  4208. :       and the command(s) issued on that date at end of this file.
  4209. :       Requires DOS's FIND (somewhere in current PATH is fine).
  4210. :       Use "CURRENT /C" (not the quotes) to clear all dates from file.
  4211. :-----------------------------------------------------------------------
  4212.  if (%1%2)==(dateis) goto GOTIT
  4213.  if (%1)==(/?) goto SYNTAX
  4214.  if (%1)==() goto SYNTAX
  4215.  for %%x in (:) do set colons=%%x%%x
  4216.  for %%x in (c C) do if (%1)==(/%%x) goto CLEAR
  4217.  set program=%1 %2 %3 %4
  4218.  ver|date>temptemp.bat
  4219.  echo %0 %%1 %%2 %%3 %%4>current.bat
  4220.  temptemp
  4221. :GOTIT -----------------------------------------------------------------
  4222.  set date=%4
  4223.  find /c "%colons%%4%program%" C:\BAT\%0.BAT>temptemp.bat
  4224.  echo set current=%%2>--------.bat
  4225.  call temptemp.bat
  4226.  if (%current%)==(0) echo %colons%%date%%program%>>C:\BAT\%0.BAT
  4227.  if (%current%)==(0) goto DO_IT
  4228.  echo Command: %program%
  4229.  echo          has already been run today.
  4230.  goto CLEANUP
  4231. :DO_IT -----------------------------------------------------------------
  4232.  cls
  4233.  echo Issuing command: %program% ...
  4234.  echo.
  4235.  call %program%
  4236.  goto CLEANUP
  4237. :CLEAR -----------------------------------------------------------------
  4238.  type C:\BAT\%0.BAT|find /v "%colons%">C:\BAT\%0.BAT
  4239. :CLEANUP ---------------------------------------------------------------
  4240.  for %%x in (-------- temptemp current) do if exist %%x.bat del %%x.bat
  4241.  for %%x in (program colons current date) do set %%x=
  4242.  goto END
  4243. :SYNTAX ----------------------------------------------------------------
  4244.  cls
  4245.  echo.
  4246.  echo    Name: ONCEADAY.BAT
  4247.  echo.
  4248.  echo  Author: Vernon Frazee 03/03/94
  4249.  echo.
  4250.  echo Purpose: Run specified command only once a day.
  4251.  echo.
  4252.  echo  Syntax: ONCEADAY program_name/command [parm_1] [parm_2] [parm_3]
  4253.  echo.
  4254.  echo          ONCEADAY /C  clears all entries
  4255.  echo.
  4256.  echo          ONCEADAY /?  displays this help
  4257.  echo.
  4258.  echo Example: ONCEADAY DEFRAG C: /F /SN
  4259.  echo.
  4260.  echo   Notes: Requires DOS's FIND (must be available in current PATH)
  4261.  echo.
  4262.  echo          Requires at least approx 50 bytes free environment space
  4263.  echo.
  4264.  echo          ONCEADAY.BAT is self modifying!  (It keeps track of when
  4265.  echo                       and what was run at the end of the file).
  4266.  echo.
  4267.  goto END
  4268. :END (Data storage begins below) --------------------------------- -vjf-
  4269.  
  4270. RD> Thanks again.
  4271.  
  4272.     No problem.  Let me know how you make out.
  4273.  
  4274.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4275.  
  4276. -!- OLMS 2.53p+ [ERSBN55C]
  4277.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4278.  
  4279. ─ Area: Batch Language Programming                     FI ────────────────────
  4280.   Msg#: 430                                          Date: 06 Mar 96  18:32:00
  4281.   From: Vernon Frazee                                Read: Yes    Replied: No
  4282.     To: Larry Kwiatkowski                            Mark:
  4283.   Subj: Caps in ENV
  4284. ──────────────────────────────────────────────────────────────────────────────
  4285. WE> you need a lot of if-statements to ask for all possiblities ...
  4286. WE>   set variable=example
  4287. WE>   set variable=Example
  4288. WE>   set variable=EXAmple
  4289. WE> It would be much easier if I could change the content of an
  4290. WE> environment variable to either small or capital letters.
  4291.  
  4292. LK> I use a rather complicated routine to do exactly that - map the file
  4293. LK> names to all caps - using GET.EXE and QEDIT. I hope there is some
  4294. LK> simpler way to accomplish mapping to all caps. Does anyone have a
  4295. LK> workable solution?
  4296.  
  4297.     Here's a fairly simple "COMMAND.COM only" example:
  4298.  
  4299.       @echo off
  4300.       :---------------------------------------------------
  4301.       :UP-CASE.BAT - UPPERcases user parameters
  4302.       :              (up to about 49 characters)
  4303.       : For example: up-case WiLe e cOyOtE
  4304.       :     returns: WILE E COYOTE
  4305.       :        Note: Results stored in evar UP-CASE
  4306.       :---------------------------------------------------
  4307.        if (%1)==() goto End
  4308.        path>~savpath.bat
  4309.        for %%x in (up-case path) do set %%x=
  4310.       :Loop ----------------------------------------------
  4311.        path %1
  4312.        if not (%up-case%)==() set up-case=%up-case% %path%
  4313.        if (%up-case%)==() set up-case=%path%
  4314.        shift
  4315.        if not (%1)==() goto Loop
  4316.        echo %up-case%
  4317.        for %%x in (call del) do %%x ~savpath.bat
  4318.       :End ----------------------------------------- -vjf-
  4319.  
  4320.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4321.  
  4322. -!- OLMS 2.53p+ [ERSBN55C]
  4323.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4324.  
  4325. ─ Area: Batch Language Programming                     FI ────────────────────
  4326.   Msg#: 402                                          Date: 08 Mar 96  23:14:04
  4327.   From: Dennis Mccunney                              Read: Yes    Replied: No
  4328.     To: Greg Paksi                                   Mark:
  4329.   Subj: Two OS's on one drive?
  4330. ──────────────────────────────────────────────────────────────────────────────
  4331.  ** From Greg Paksi to Brian Altenpohl on 29 Feb 96  16:53:54
  4332.  ** Re: Two OS's on one drive?
  4333.  
  4334.  BA> Also, you may want to take a look into QNX, it is a great O/S, and
  4335.  BA> comes with the QNX loader, which will allow you up to 4 different OSs
  4336.  BA> on a  single machine.  Perhaps newer version of QNX will allow more.
  4337.  BA> Or you could write a simple Boot-Manager program - it isn't very
  4338.  
  4339.  GP> What's QNX?  How is it different than DOS, UNIX, OS/2, WINDOWS NT,
  4340.  GP> etc.?
  4341.  
  4342.     QNX is an operating system from a company in Canada called QNX
  4343.  (formerly known as Quantum).  It began as a UNIX-like OS optimised to
  4344.  run on Intel CPUs (and would run reasonably on XTs and well on ATs).
  4345.  It has evolved into an OS aimed at the real-time market, with built-in
  4346.  network awareness.
  4347.  
  4348.  
  4349.  
  4350. -!- Blue Wave/DOS v2.30
  4351.  ! Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/304)
  4352.  
  4353. ─ Area: Batch Language Programming                     FI ────────────────────
  4354.   Msg#: 448             Local                        Date: 11 Mar 96  18:30:57
  4355.   From: Bat Lang                                     Read: Yes    Replied: No
  4356.     To: Steve Meech                                  Mark:
  4357.   Subj: Copying files
  4358. ──────────────────────────────────────────────────────────────────────────────
  4359.  -=> Quoting Steve Meech to All, [09 Mar 96  00:29:06] <=-
  4360.  
  4361.  SM> Anyway, back on topic, the problem is that I have to transfer 13Mb of
  4362.  SM> files, many of which don't change from one day to the next.
  4363.  
  4364.  SM> Is there a way of copying only those files which are _different_ on
  4365.  SM> the two machines, to save time (in the way PKZIP's "update" function
  4366.  SM> does).
  4367.  SM> I'd be interested in a batch-file or utility solution.
  4368.                                        ^^^^^^^^^^^^^^^^^^^
  4369.  
  4370. There is a nifty util in the BFDS files called DIRCOMP:
  4371.  
  4372. DIRCO511.ZIP  117060 12-18-95  DIRCOMP.EXE (5.11):  Updates files in one
  4373.                                subdirectory based on files in another
  4374.                                subdirectory.  Similar in some ways to DOS's
  4375.                                REPLACE command
  4376.  
  4377. Here is a batch file I use with this to maintain a portable
  4378. parallel-port hard drive (Gator) as a mirror of another drive on my
  4379. system.
  4380.  
  4381. ::UPD.BAT to compare two dirs, and kill dir2 files not in dir1 & copy
  4382. ::        dir1 files to dir2 that are more recent, or not in dir2.
  4383. @echo off
  4384. CP /T:N,10             Do you want the Gator UpDated?
  4385. if %EL% 2 goto end
  4386. dirco k: l: /KILL /APPEND /-I
  4387. :end
  4388.  
  4389. Saves me MANY hours each month, and hasn't messed up yet.  Also
  4390. maintains a log of it's activities.  The second line uses Chad's Choice
  4391. Plus (CP102).  Could use CHOICE or leave it out.
  4392. Note:  The %EL% is a shortcut allowed by my inclusion of:
  4393.  
  4394. SET EL=ERRORLEVEL   ;in my AEBat file.
  4395.  
  4396. If your DOS includes REPLACE, you might get it to do your bidding?
  4397. I also renamed the DIRCOMP.EXE so it looks like the archive name.
  4398. Good Modeming!  /\oo/\
  4399.  
  4400. ... NetMail: 1:382/1201 or E-mail: bat.lang@1201.ima.infomail.com
  4401.  
  4402. -!- Blue Wave/Max v2.30
  4403.  ! Origin: The HUB * Austin TX * Centex PCUG * 512-346-1852 (1:382/1201)
  4404.  
  4405. ─ Area: Batch Language Programming                     FI ────────────────────
  4406.   Msg#: 445                                          Date: 11 Mar 96  12:47:00
  4407.   From: Gottfried Hommon                             Read: Yes    Replied: No
  4408.     To: STEPHAN HOPPE                                Mark:
  4409.   Subj: Sloppy batch file
  4410. ──────────────────────────────────────────────────────────────────────────────
  4411. -----------------------------------------  Vienna, the 11.Mar.1996 at 12.46
  4412.   Hi STEPHAN!
  4413.  
  4414. 29-Feb-96 19:35, STEPHAN HOPPE wrote to ALL
  4415.           Subject: Sloppy batch file
  4416.  
  4417.  SH> Is there any way of making this a little less bulky?
  4418.  
  4419. >>>>>GETDAY.BAT
  4420.  SH> @echo off
  4421.  SH> REM the line below returns the day of the month as an errorlevel. . .
  4422.  SH> c:\utility\1tellme.exe day
  4423.  SH> if errorlevel 1 if not errorlevel 2 set Today=1
  4424.  SH> if errorlevel 2 if not errorlevel 3 set Today=2
  4425.  SH> .
  4426.  SH> if errorlevel 31 if not errorlevel 32 set Today=31
  4427.                       ^^^^^^^^^^^^^^^^^^^^
  4428.                       is not necessary
  4429.  
  4430. do this:
  4431.  
  4432. for %%f in (1 2 3 4 5 6 7 8 9 10 11 12 13) do if errorlevel %%f set Today=%%f
  4433. for %%f in (14 15 16 17 18 19 20 21 22 23) do if errorlevel %%f set Today=%%f
  4434. for %%f in (24 25 26 27 28 29 30 31) do if errorlevel %%f set Today=%%f
  4435.  
  4436.  with friendly greetings
  4437.  from Gottfried Hommon
  4438.  
  4439. -!- Terminate 1.50/Pro
  4440.  ! Origin: ---------------> NOVELL DOS 7.15 USER <--------------- (2:310/65.78)
  4441.  
  4442. ─ Area: Batch Language Programming                     FI ────────────────────
  4443.   Msg#: 435                                          Date: 12 Mar 96  05:49:03
  4444.   From: Vernon Frazee                                Read: Yes    Replied: No
  4445.     To: Scott Farrell                                Mark:
  4446.   Subj: File_id.diz
  4447. ──────────────────────────────────────────────────────────────────────────────
  4448. MC> Check a zip file to see if it has a file_id.diz. if not then open
  4449. MC> the editor (ide.exe) which produces a file_id.diz in its own
  4450. MC> directory then this has to be inserted in the zip that was
  4451. MC> checked. If the file has a file_id.diz then continue to check the
  4452. MC> next zip.
  4453.  
  4454. SF> Have you got a solution to this?
  4455.  
  4456.     Stick the following simple BATch file in some directory in
  4457.     your PATH.  (I keep my BATch files in "C:\BAT" for example).
  4458.  
  4459.       @echo off
  4460.       :ZIPID.BAT
  4461.        pkunzip %1 file_id.diz
  4462.        if errorlevel 11 goto End
  4463.        edit file_id.diz
  4464.        pkzip %1 file_id.diz
  4465.        del file_id.diz
  4466.       :End
  4467.  
  4468.     Now change to the drive:\directory containing the ZIP files you
  4469.     want to work on and type the command:
  4470.  
  4471.       for %x in (*.zip) do call zipid %x
  4472.  
  4473.     That's it.
  4474.  
  4475.     Each ZIP file in your current directory will be checked for the
  4476.     presence of a FILE_ID.DIZ file.  If it exists, ZIPID.BAT file simply
  4477.     exits (and then the for-in-do command above re-launches it with a
  4478.     new filename.ZIP).  If a FILE_ID.DIZ didn't exist, DOS EDIT is
  4479.     launched so you can create one.  When you exit EDIT, PKZIP adds your
  4480.     new FILE_ID.DIZ to the filename.ZIP file just checked, your
  4481.     FILE_ID.DIZ is deleted, and ZIPID.BAT exits back to DOS.  And, when
  4482.     the for-in-do is done presenting all the filename.ZIPs to ZIPID.BAT,
  4483.     all your ZIP files should contain a FILE_ID.DIZ.
  4484.  
  4485.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4486.  
  4487. -!- OLMS 2.53p+ [ERSBN55C]
  4488.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4489.  
  4490. ─ Area: Batch Language Programming                     FI ────────────────────
  4491.   Msg#: 447                                          Date: 13 Mar 96   9:49:00
  4492.   From: Horst Schaeffer                              Read: Yes    Replied: No
  4493.     To: Paul Emmons                                  Mark:
  4494.   Subj: Scripting programs
  4495. ──────────────────────────────────────────────────────────────────────────────
  4496. -=> quoting Paul Emmons to All (7 Mar 96) <=-
  4497.  
  4498. PE> [...]
  4499. PE> Could anyone describe the basic techniques or algorithms which
  4500. PE> these various systems use?
  4501.  
  4502. -+-+- quote from Richard Marks' UUencode/UUdecode package:
  4503.  
  4504. The basic scheme is to break groups of 3 eight bit characters (24 bits)
  4505. into 4 six bit characters and then add 32 (a space) to each six bit
  4506. character which maps it into the readily transmittable character.
  4507. Another way of phrasing this is to say that the encoded 6 bit
  4508. characters are mapped into the set:
  4509.         `!"#$%&'()*+,-./012356789:;<=>?@ABC...XYZ[\]^_
  4510. for transmission over communications lines.
  4511.  
  4512. As some transmission mechanisms compress or remove spaces, spaces are
  4513. changed into back-quote characters (a 96).  (A better scheme might be
  4514. to use a bias of 33 so the space is not created, but this is not done.)
  4515.  
  4516. Another newer less popular encoding method, called XX-encoding uses the
  4517. set:    +-01..89ABC...XYZabc...xyz
  4518.  
  4519. In my opinion, XX-encoding is superior to UU-encoding because it uses
  4520. more "normal" characters that are less likely to get corrupted.  In
  4521. fact several of the special characters in the UU set do not get thru an
  4522. EBCDIC to ASCII translation correctly.
  4523. -+-+- unquote
  4524.  
  4525. PE> 256^4 = 4.294968E+09, and 85^5 = 4.437053E+09.  Therefore, four
  4526. PE> binary bytes could be encoded into five ascii characters using any
  4527. PE> 85 of the ascii values between 32 and 127.  Although I haven't
  4528. PE> tried implementing this in assembler, I would guess that
  4529. PE> recovering the original binary file from such a script would fit
  4530. PE> the architecture and instruction set of the 86 processors easily,
  4531. PE> i.e. the necessary code could be given in a short enough debug
  4532. PE> script header.
  4533.  
  4534. For a range of 85 you would need 32 bit multiplications. No big problem
  4535. even for a 8086, but the DEBUG header will become a little larger.
  4536. Main problem is to define a set of 85 characters that is safe enough
  4537. for FIDO mails. I'm not sure which characters between 31 and 127 have
  4538. to be definitely excluded to avoid problems.
  4539.  
  4540. PE> Probably others have thought of this principle or a better one, so
  4541. PE> there is no point in re-inventing the wheel if it has been done. I
  4542. PE> would like to know how Chad's and Horst's encoding systems work,
  4543. PE> but the answer is not obvious from the scripts they produce.
  4544.  
  4545. I think everyone used the simple method of shifting 4*6 bits out of
  4546. 24. The idea of using a range other than 2^n is a very interesting
  4547. approach indeed.
  4548.  
  4549. However a ratio of 5/3 (vs. 4/3) would make scripts only 6.25% smaller
  4550. (not counting the overhead), and in zipped mail packages it will
  4551. probably make no difference at all.
  4552. Is is worth introducing a new standard?
  4553.  
  4554. Horst.
  4555.  
  4556. ... Q4FM 2.10 ... horst@confusion.rmc.de
  4557.  
  4558. -!- FM 2.02 / ScanToss
  4559.  ! Origin: Don't follow leaders! (2:2480/13.75)
  4560.  
  4561. ─ Area: Batch Language Programming                     FI ────────────────────
  4562.   Msg#: 429                                          Date: 12 Mar 96  22:41:00
  4563.   From: William Lipp                                 Read: Yes    Replied: No
  4564.     To: Larry Nelson                                 Mark:
  4565.   Subj: Sloppy Batch
  4566. ──────────────────────────────────────────────────────────────────────────────
  4567.  -=> Quoting Larry Nelson to William Lipp <=-
  4568.  
  4569.  LN> for %%q in (1 2 3) do if errorlevel %%q goto %%q
  4570.  
  4571.  LN> When I reversed the order of the options in For's set to
  4572.  LN> (3 2 1) the result was always 1
  4573.  
  4574.  LN> Any body got an idea why For needs the options in asending
  4575.  LN> order rather than desending?
  4576.  
  4577. The behavior of for-in-do with goto was a topic of discussion a few
  4578. months back.  My recollection is that the loop finishes all iterations
  4579. before executing any "goto" statement.  It then acts upon the
  4580. last goto.
  4581.  
  4582.  
  4583. ___ Blue Wave/QWK v2.12
  4584.  
  4585. -!- Maximus 3.01
  4586.  ! Origin: this space available bbs (1:141/1111)
  4587.  
  4588. ─ Area: Batch Language Programming                     FI ────────────────────
  4589.   Msg#: 424                                          Date: 13 Mar 96  20:48:00
  4590.   From: Vernon Frazee                                Read: Yes    Replied: No
  4591.     To: Dennis Mccunney                              Mark:
  4592.   Subj: Batch Problem
  4593. ──────────────────────────────────────────────────────────────────────────────
  4594. DM> Are you telling 4DOS to load itself and its environment and aliases
  4595. DM> into UMBs?  There are an assorment of directives settable in
  4596. DM> 4DOS.INI to specify this:
  4597. DM>   UMBAlias                Load global aliases in UMB
  4598. DM>   UMBDirHistory           Load global directory history in UMB
  4599. DM>   UMBEnvironment          Load master environment in UMB
  4600. DM>   UMBHistory              Load history in UMB
  4601. DM>   UMBLoad                 Load resident part of 4DOS in UMB
  4602. DM> Do so, and your environment and other things 4DOS uses come out of
  4603. DM> conventional memory, as does all but 256 bytes of the resident
  4604. DM> portion of 4DOS itself)
  4605. DM> I strongly suspect the memory values you posted above would be
  4606. DM> rather different if you did this.
  4607.  
  4608.     As suggested I created a 4DOS.INI file containing the following:
  4609.  
  4610.       UMBAlias
  4611.       UMBDirHistory
  4612.       UMBEnvironment
  4613.       UMBHistory
  4614.       UMBLoad
  4615.  
  4616.     From "mem/c" before creating 4DOS.INI ------------------------------
  4617.     Free       747,616  (730K)    635,200  (620K)
  4618.  
  4619.     From "mem/c" after after creating 4DOS.INI -------------------------
  4620.     Free       747,616  (730K)    635,200  (620K)
  4621.  
  4622.     What am I doing wrong?
  4623.  
  4624. VF> Hmmm... With just a 360K disk, the tools I would probably grab would
  4625. VF> be everything I might need to format a hard drive: DEBUG, FDISK, and
  4626. VF> FORMAT (68,020 bytes); a few general tools like: CHKDSK, CHOICE,
  4627. VF> EDLIN, and FIND (33439 bytes); of course GWBASIC (80,592 bytes); and
  4628. VF> then my communications program {COMMO} (29,872 bytes) so I could
  4629. VF> logon to any one of a multitude of systems I have access to and
  4630. VF> download anything else I might need. <g>  On a MS-DOS v6.22 bootable
  4631. VF> diskette that should still leave over 10,000 bytes for whatever
  4632. VF> else.
  4633.  
  4634. DM> You don't compress the executables?
  4635.  
  4636.     Not usually, no.
  4637.  
  4638. DM> You can't do it to COMMAND.COM, but everything else will pack down
  4639. DM> nicely.
  4640.  
  4641.     DEBUG.EXE, FORMAT.COM, and CHKDSK.EXE already come compressed
  4642.     but yes, packing the others (PKLITE) reduced overall size by
  4643.     almost 11%.  Good idea, thanks!
  4644.  
  4645.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4646.  
  4647. -!- OLMS 2.53p+ [ERSBN55C]
  4648.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4649.  
  4650. ─ Area: Batch Language Programming                     FI ────────────────────
  4651.   Msg#: 440                                          Date: 13 Mar 96  20:48:12
  4652.   From: Vernon Frazee                                Read: Yes    Replied: No
  4653.     To: Phi Nguyen                                   Mark:
  4654.   Subj: write to start of text fi
  4655. ──────────────────────────────────────────────────────────────────────────────
  4656. PN>  ---------PREPEND.BTM------------------
  4657. PN>  @*echo off
  4658. PN>  *if %# lt 2 goto Syntax_Error
  4659. PN>  *setdos /x-1
  4660. Vf> [ ... 46 lines deleted ... ]
  4661. PN>  ---------------------------------------
  4662.  
  4663.      Here's a simple example that works with DOS:
  4664.  
  4665.        @echo off
  4666.        :PREPEND.BAT
  4667.         if (%2)==() goto End
  4668.         if not exist %1 goto End
  4669.         set ~fn=%1
  4670.         copy %~fn% ~1>nul
  4671.        :Loop
  4672.         shift
  4673.         if (%1)==() goto Copy
  4674.         if not (%~tx%)==() set ~tx=%~tx% %1
  4675.         if (%~tx%)==() set ~tx=%1
  4676.         goto Loop
  4677.        :Copy
  4678.         echo %~tx%>~2
  4679.         copy ~2+~1 %~fn%>nul
  4680.         for %%x in (1 2) do del ~%%x
  4681.         for %%x in (fn tx) do set ~%%x=
  4682.        :End
  4683.  
  4684.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4685.  
  4686. -!- OLMS 2.53p+ [ERSBN55C]
  4687.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4688.  
  4689. ─ Area: Batch Language Programming                     FI ────────────────────
  4690.   Msg#: 448                                          Date: 15 Mar 96  17:58:01
  4691.   From: Vernon Frazee                                Read: Yes    Replied: No
  4692.     To: Larry Nelson                                 Mark:
  4693.   Subj: Sloppy Batch
  4694. ──────────────────────────────────────────────────────────────────────────────
  4695. JK> for %%a in (1 2 3 4 5 6 7 8 9..... 31) do if errorlevel %%a .....
  4696. JK> (A classic .BAT improvement!)
  4697.  
  4698. WL> Since the errorlevel function is "errorlevel greater than or equal
  4699. WL> to N", this code would execute the "if" section 31 times for a
  4700. WL> "no error" return of zero.  That was probably not what you had in
  4701. WL> mind.
  4702.  
  4703. LN> For seems to tweak the order of things. Joe's example worked fine
  4704. LN> for me when I use it as in the following....
  4705. LN>   ::4tst.bat/DOS62.0
  4706. LN>   @echo off
  4707. LN>   cls
  4708. LN>        choice/cabc
  4709. LN>        for %%q in (1 2 3) do if errorlevel %%q goto %%q
  4710. LN>  :1
  4711. LN>     echo a
  4712. LN>     goto L8r
  4713. LN>  :2
  4714. LN>     echo b
  4715. LN>     goto L8r
  4716. LN>  :3
  4717. LN>     echo c
  4718. LN>  :L8r
  4719. LN> When I reversed the order of the options in For's set to (3 2 1) the
  4720. LN> result was always "a" Any body got an idea why For needs the options
  4721. LN> in asending order rather than desending?
  4722.  
  4723.     Because DOS will process everything in between the parenthesis
  4724.     before it makes it's final descision.
  4725.  
  4726.     For example, with (1 2 3) and you press B, DOS will do:
  4727.  
  4728.       if errorlevel 1 goto 1       (which proves true)
  4729.       if errorlevel 2 goto 2       (which proves true)
  4730.       if errorlevel 3 goto 3       (which proves not true)
  4731.  
  4732.     Now that it's done testing it does the last thing that proved true,
  4733.     "goto 2", which is correct.
  4734.  
  4735.     But if you flip it around, (3 2 1), and press B, DOS will do:
  4736.  
  4737.       if errorlevel 3 goto 3       (which is not true)
  4738.       if errorlevel 2 goto 2       (which is true)
  4739.       if errorlevel 1 goto 1       (which is true)
  4740.  
  4741.     Now that it's done testing it does the last thing that proved true,
  4742.     "goto 1", which is incorrect.
  4743.  
  4744.     Clear as mud yet? <G>
  4745.  
  4746.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4747.  
  4748. -!- OLMS 2.53p+ [ERSBN55C]
  4749.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  4750.  
  4751. ─ Area: Batch Language Programming                     FI ────────────────────
  4752.   Msg#: 438                                          Date: 16 Mar 96  08:01:00
  4753.   From: David Roper                                  Read: Yes    Replied: No
  4754.     To: Vernon Frazee                                Mark:
  4755.   Subj: BATCH PROBLEM
  4756. ──────────────────────────────────────────────────────────────────────────────
  4757. VF> Hmmm... With just a 360K disk, the tools I would probably grab would
  4758. VF> be everything I might need to format a hard drive: DEBUG, FDISK, and
  4759. VF> FORMAT (68,020 bytes); a few general tools like: CHKDSK, CHOICE,
  4760. VF> EDLIN, and FIND (33439 bytes); of course GWBASIC (80,592 bytes); and
  4761. VF> then my communications program {COMMO} (29,872 bytes) so I could
  4762. VF> logon to any one of a multitude of systems I have access to and
  4763. VF> download anything else I might need. <g>  On a MS-DOS v6.22 bootable
  4764. VF> diskette that should still leave over 10,000 bytes for whatever
  4765. VF> else.
  4766. VF>    DEBUG.EXE, FORMAT.COM, and CHKDSK.EXE already come compressed
  4767.   >    but yes, packing the others (PKLITE) reduced overall size by
  4768.   >    almost 11%.  Good idea, thanks!
  4769.  
  4770.   Vernon, if you're trying to shrink 'em (and I have a similar disk to
  4771.   yours for traveling) I used the COMTOEXE and then LZEXE so that I
  4772.   didn't have to buy PKLITE.  Nothing wrong with buying PKLITE, but
  4773.   for those reading this message, there's the other way "out."
  4774.  
  4775.          _____oOOo_/00\_oOOo_____      david.roper@mms.raleigh.nc.us
  4776.      1996          \__/            201 WINDING BROOK Dr, GARNER NC 27529
  4777.  
  4778. -!- FLAME v1.1
  4779.  ! Origin: Full Internet Access $15.00, (919) 779-6674 or MMS.NET (1:151/102)
  4780.  
  4781. ─ Area: Batch Language Programming                     FI ────────────────────
  4782.   Msg#: 447                                          Date: 17 Mar 96  15:27:05
  4783.   From: Stamatis Kantartzis                          Read: Yes    Replied: No
  4784.     To: Jim Danvers                                  Mark:
  4785.   Subj: Prompt
  4786. ──────────────────────────────────────────────────────────────────────────────
  4787. Hi Jim! What's up?
  4788.  
  4789. On 16-Mar-96, at 09:23:00, Jim Danvers wrote this to All about Prompt:
  4790.  
  4791.  JD> Hi guys... I would like to get a "spinning wheel" type
  4792.  JD> prompt for command lines. IE;, a spinning | symbol... can we do
  4793.  JD> this through ansi? That's all.... call me bored. <g>
  4794.  
  4795. Here's the latest version of SPIN.BAT:
  4796.  
  4797. @echo off
  4798. loadbtm on
  4799. setlocal
  4800.  
  4801. ::-----Init spinning characters
  4802. set s0=`%=|`
  4803. set s1=/
  4804. set s2=-
  4805. set s3=\
  4806.  
  4807. ::-----Init pointer to starting position
  4808. set s=0
  4809.  
  4810. :-----Save cursor
  4811. set cursor=%_CO:%_CI
  4812.  
  4813. ::-----This is for olders version of 4DOS
  4814. if "%cursor" eq ":" set cursor=10:100
  4815.  
  4816. ::-----Turn off cursor
  4817. setdos /s0:0
  4818.  
  4819. ::-----Display title
  4820. echo %=nSPIN.BAT - Phi Nguyen 03.04.96%=n
  4821. echo Press any key to quit%=n
  4822.  
  4823. ::-----Display prompt. It requires 2 trailing spaces (1 will be erased)
  4824. echos `Please wait:  `
  4825.  
  4826. do while %_kbhit eq 0
  4827.   ::-----Display spin
  4828.   ::     %=b uses to clear the previous spin char (backspace)
  4829.   ::     %[s%s] uses to show the current spin char (like *ptr in C)
  4830.   echos %=b%[s%s]
  4831.  
  4832.   ::-----Increase the pointer to next spin char. It will rotate from
  4833.   ::     0 to 3 to 0 to 3 ...
  4834.   set s=%@word[%s,1 2 3 0]
  4835.  
  4836.   ::-----Do whatever here
  4837. enddo
  4838.  
  4839. ::-----Clear prompt
  4840. echos %=r               %=r
  4841.  
  4842. ::-----Eat keypressed
  4843. inkey %%key
  4844.  
  4845. ::-----Turn on cursor
  4846. setdos /s%cursor
  4847. endlocal
  4848.  
  4849.  
  4850.              |-=-=-=> Sincerely, Stamatis Kantartzis <=-=-=-|
  4851.  
  4852. .!. Inflation means the Buck does not stop here...
  4853.  
  4854. -!- Terminate 3.00
  4855.  ! Origin:  (1:109/570.14)
  4856.  
  4857. ─ Area: Batch Language Programming                     FI ────────────────────
  4858.   Msg#: 430                                          Date: 21 Mar 96  00:16:11
  4859.   From: Paul Emmons                                  Read: Yes    Replied: No
  4860.     To: Jeff Dubois                                  Mark:
  4861.   Subj: zipping gazillions of tex
  4862. ──────────────────────────────────────────────────────────────────────────────
  4863. -> Is there a simply way, via batch, to zip up a gazillion *.TXT files
  4864. -> into individual zip files and upon completion then delete all the
  4865. -> *.TXT files in that directory?
  4866. ->
  4867. -> What I got:  A.TXT, B.TXT, C.TXT ...
  4868. -> What I want: A.ZIP, B.ZIP, C.ZIP ...
  4869. ->
  4870. -> There is an easy way.  But I don't know it. :-)
  4871.  
  4872. I think the best way is to create a subdirectory to receive the
  4873. zip files, or at least put them in a subdirectory which has no
  4874. files *.txt.  If this subdirectory is \TEM, then you need:
  4875.  
  4876. for %%f in (*.txt) do pkzip -omex \tem\%%f %%f
  4877. ren \tem\*.txt *.zip
  4878.  
  4879. The pkzip -m flag will remove the files it zips up.  The files
  4880. created by pkzip in \tem are originally named *.txt, and you
  4881. have to rename them *.zip in a separate line.
  4882. -!- FidoPCB v1.4 [ff348/b]
  4883.  ! Origin: The Bauding House (1:2626/312) 610/692-7392
  4884.  
  4885. ─ Area: Batch Language Programming                     FI ────────────────────
  4886.   Msg#: 450                                          Date: 23 Mar 96  23:45:00
  4887.   From: Gary Smith                                   Read: Yes    Replied: No
  4888.     To: Jeff Dubois                                  Mark:
  4889.   Subj: zipping gazillions of tex
  4890. ──────────────────────────────────────────────────────────────────────────────
  4891. JD> Is there a simply way, via batch, to zip up a gazillion *.TXT files into
  4892.   > individual zip files and upon completion then delete all the *.TXT files in
  4893.   > that directory?
  4894.  
  4895. JD> What I got:  A.TXT, B.TXT, C.TXT ...
  4896.   > What I want: A.ZIP, B.ZIP, C.ZIP ...
  4897.  
  4898. JD> There is an easy way.  But I don't know it. :-)
  4899.  
  4900. The following is fairly straightforward.  It assumes that you're
  4901. running it in the directory where the TXT files reside, and does
  4902. no error checking.  If you like lots of activity on the screen,
  4903. remove the two occurrences of "> nul".
  4904.  
  4905.  @echo off
  4906.  md $$temp$$
  4907.  for %%f in (*.txt) do pkzip -m $$temp$$\%%f %%f > nul
  4908.  ren $$temp$$\*.txt *.zip
  4909.  move $$temp$$\*.zip . > nul
  4910.  rd $$temp$$
  4911. -!-
  4912.  * OLX 1.53 * Veni, vidi, velcro - I came, I saw, I stuck around
  4913.  
  4914. -!- WILDMAIL!/WC v4.12
  4915.  ! Origin: The Computer Room-Pickerington, Oh  (1:226/110.0)
  4916.  
  4917. ─ Area: Batch Language Programming                     FI ────────────────────
  4918.   Msg#: 443                                          Date: 26 Mar 96  17:25:02
  4919.   From: Vernon Frazee                                Read: Yes    Replied: No
  4920.     To: Roy Reed                                     Mark:
  4921.   Subj: J. Dubois request, others complaints
  4922. ──────────────────────────────────────────────────────────────────────────────
  4923. RR> I tried a quick and dirty way to convert .txt files to .zip files
  4924. RR> per request of Mr. Dubois.  Per response of Mr. Primus, this method
  4925. RR> did not retain the .txt extension within the zipped file.  Per Mr.
  4926. RR> Frazee's response, extensionless files in the directory were not
  4927. RR> protected.  Per this response, the batch file below handles said
  4928. RR> complaints.  It's just not as cheap and dirty as original.  For Mr.
  4929. RR> Fraley, I truncated the .txt so that the pkzip command in the
  4930. RR> FOR-IN-DO would zip the file and give it the same name, which
  4931. RR> resulted in loss of extension inside the .zip file.
  4932. RR> I love doing this to get Frazee cranking - hehehehehe.
  4933.  
  4934.     Guess who?  <G>
  4935.  
  4936. RR> -!---upper extraction line-----
  4937. RR> @echo off
  4938. RR> if "%1"=="blasphemy" goto blasphemy
  4939. RR> ren *.  *.^-^
  4940. RR> ren *.txt  *.
  4941. RR> for %%x in (*.) do call %0 blasphemy %%x
  4942. RR> del *.txt
  4943. RR> ren *.^-^  *.
  4944. RR> set base=
  4945. RR> goto end
  4946. RR> :blasphemy
  4947. RR> set base=%2
  4948. RR> ren %2 %2.txt
  4949. RR> pkzip %2 %2.txt
  4950. RR> :end
  4951. RR> -!---lower extraction line-----
  4952.  
  4953.     Here, try this ZIP&DEL.BAT
  4954.  
  4955.       @echo off
  4956.       >~tmptmp~.bat mode %1
  4957.       >invalid.bat echo set ~fn~=%%3
  4958.       for %%x in (call del) do %%x ~tmptmp~.bat
  4959.       pkzip -exmo %~fn~% %1 | del invalid.bat
  4960.  
  4961.     To use it, first make sure you the above ZIP&DEL.BAT, DOS's MODE.COM
  4962.     and Phil Katz' PKZIP.EXE in your PATH (or current directory) and at
  4963.     least 18 bytes free environment space.
  4964.  
  4965.     Now go to some directory containing at least a few files with the
  4966.     same extension, for example ".TXT", and then type the command:
  4967.  
  4968.       for %x in (*.txt) do call zip&del %x
  4969.  
  4970.     That's it.  When this four-working-line "ZIP&DEL.BAT" gets done:
  4971.  
  4972.     a) all the *.TXT files will each be in their own individual
  4973.        "samename.ZIP" file
  4974.  
  4975.     b) with a date and time stamp matching the original file
  4976.  
  4977.     c) and the originals deleted.
  4978.  
  4979.     "Kewl" eh?  <G>
  4980.  
  4981.     Now give me something to "crank" on.  That may have taken the better
  4982.     part of maybe a minute to whip up using nothing more than "COPY CON"
  4983.     a-n-d it required no further editing.  <grin>
  4984.  
  4985.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  4986. -!- Terminate 3.00
  4987.  ! Origin: Terminate = Pointmailer+Tosser+Reader+Packer+QWK! (1:135/71.17)
  4988.  
  4989. ─ Area: Batch Language Programming                     FI ────────────────────
  4990.   Msg#: 449                                          Date: 27 Mar 96  03:05:37
  4991.   From: Dennis Mccunney                              Read: Yes    Replied: No
  4992.     To: Otto Lang                                    Mark:
  4993.   Subj: PATH limit
  4994. ──────────────────────────────────────────────────────────────────────────────
  4995.  ** From Otto Lang to Dennis McCunney on 24 Mar 96  16:30:00
  4996.  ** Re: PATH limit
  4997.  
  4998.  DM> JC> Well, some of us STILL use only DOS. Like me. I use a menu program,
  4999.  DM> JC> but I also do things from the DOS prompt and from a File Manager
  5000.  DM> JC> program. Therefore, I have a fairly long path. Witness:
  5001.  
  5002.  DM> JC> Path C:\;C:\DOS;C:\UTIL\TV;C:\UTIL\PAK;C:\3DMENU;C:\WP60;
  5003.  DM> JC> Path %PATH%;C:\UTIL\PGP;C:\UTIL\UUCODE;C:\SOUND\UTIL\DAPLAY;
  5004.  
  5005.  DM>    I still use only DOS here, as well, but I'm at pains to keep my PATH
  5006.  DM> short.  The current one is:
  5007.  
  5008.  DM> PATH=e:\;c:\usr\batch;c:\usr\vdisk;c:\usr\bin;c:\4dos;c:\usr\lbin;c:\dos;
  5009.  DM> c:\bin;c:\dgn;..;.
  5010.  
  5011.  OL> There are two lesson I learned early: (1) Keep dir names short, e.g.
  5012.  OL> UT or UTL instead of UTIL and (2) if you SUBST U: C:\USR you can save
  5013.  OL> a lot of typing and see more of your path line in the autoexec.bat.
  5014.  OL> Just don't forget the LASTDRIVE=Z!
  5015.  
  5016.     The directory names and directory structure I use are based on those
  5017.  used by UNIX.  I learned UNIX before I really spent any time in DOS,
  5018.  and I find it simpler to make my DOS environment resemble the one I
  5019.  have under UNIX as much as possible.  (With the MKS Toolkit installed,
  5020.  that can be more than you would believe...)  I've never found SUBST
  5021.  neccessary, and I use LASTDRIVE=E:, since that IS my last drive.
  5022.  
  5023.     Seeing the long PATH isn't a big problem, since it isn't that long,
  5024.  and I'm more concerned about the number of directories in it than the
  5025.  length of the directory names.  Directories are in the PATH in the
  5026.  order of frequency of access. I keep the command processor and some
  5027.  frequently used utilities on the ramdisk, so that is first in the PATH.
  5028.  
  5029.     Saving typing is provided by other 4DOS features.  I set
  5030.  environment variables to the names of frequently used directories.
  5031.  For example, I have UB=c:\usr\bin in my environment definitions.  4DOS
  5032.  interprets variables on the command line as well as in batch files, so
  5033.  I can do "p %ub", instead of "pushd c:\usr\bin".  P is an alais for
  5034.  PUSHD, an internal command in 4DOS that pushes the current directory
  5035.  onto a stack and changes to the drive directory specified as the
  5036.  argument.  POPD (aliased to "." here) pops the saved drive/directory
  5037.  from the stack and returns me to where I was.
  5038.  
  5039.  
  5040. -!- Blue Wave/DOS v2.30
  5041.  ! Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/304)
  5042.  
  5043. ─ Area: Batch Language Programming                     FI ────────────────────
  5044.   Msg#: 445                                          Date: 27 Mar 96  16:30:48
  5045.   From: Vernon Frazee                                Read: Yes    Replied: No
  5046.     To: Roy Reed                                     Mark:
  5047.   Subj: IS THIS DIRECTORY EMPTY?
  5048. ──────────────────────────────────────────────────────────────────────────────
  5049. RR> I use dos 5 and the following works for me.  I use find to pick out
  5050. RR> the "2 files and 0 bytes" if a dir is empty.  If not, it doesn't
  5051. RR> pick out, and a zero length byte file doesn't get copied, which I
  5052. RR> check to see if it exists.  I heard 4dos copies 0 byte files.  Ta
  5053. RR> ta.
  5054.  
  5055. RR> -!--- snip line-----
  5056. RR> @echo off
  5057. RR> if "%1"=="/?" goto syntax
  5058. RR> dir %1 | find "2 file(s)          0 bytes" > ~~~4now
  5059. RR> copy ~~~4now ~~~after > nul
  5060. RR> if exist ~~~after echo directory %1 is empty
  5061. RR> if not exist ~~~after echo directory %1 contains at least one file
  5062. RR> if exist ~~~4now del ~~~4now > nul
  5063. RR> if exist ~~~after del ~~~after > nul
  5064. RR> goto end
  5065. RR> :syntax
  5066. RR> echo proper syntax is, for example, isempty c:\utils   or
  5067. RR> echo isempty c:\write\wp
  5068. RR> :end
  5069. RR> -!--- snip line-----
  5070.  
  5071.     You don't really need to use FIND and a temporary file to do the
  5072.     trick.  For example:
  5073.  
  5074.       @echo off
  5075.       :CHKDIR - Does it exist?  If so, any files?
  5076.        if (%1)==() echo Syntax: %0 [[d:]\]dirname[\dir[\dir\...]]
  5077.        if (%1)==() goto End
  5078.        if not exist %1\nul echo Directory "%1" does not exist.
  5079.        if not exist %1\nul goto End
  5080.        if not exist %1\*.* echo Directory "%1" is empty.
  5081.        if exist %1\*.* echo Directory "%1" has files.
  5082.       :End
  5083.  
  5084.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  5085. -!- Terminate 3.00
  5086.  ! Origin: Get real, get better, get faster, get Terminate! (1:135/71.16)
  5087.  
  5088. ─ Area: Batch Language Programming                     FI ────────────────────
  5089.   Msg#: 448                                          Date: 27 Mar 96  09:33:30
  5090.   From: Vernon Frazee                                Read: Yes    Replied: No
  5091.     To: Tony Johnston                                Mark:
  5092.   Subj: unzip files
  5093. ──────────────────────────────────────────────────────────────────────────────
  5094. TJ> Is it possible to have abat or exe file automatically execute just
  5095. TJ> after is has been unzipped. If so how?
  5096.  
  5097.     With a ZIP file, fortunately no.  (Makes it to easy for kids to
  5098.     automatically launch something destructive).  Of course there is
  5099.     nothing stopping you from simply wrapping a BATch file around it:
  5100.  
  5101.       @echo off
  5102.       :START.BAT
  5103.        md c:\whatever
  5104.        pkunzip whatever.zip c:\whatever
  5105.        for %%x in (c: cd\whatever whatever cd\) do %%x
  5106.       :End
  5107.  
  5108.     Another alternative is to use ARJ instead of PKZIP.  For example,
  5109.     the following single ARJ command will unarchive FOOBAR.BAT from
  5110.     archive FOOBAR.ARJ and then immediately launch the FOOBAR.BAT:
  5111.  
  5112.     arj b foobar.arj foobar.bat -jqfoobar.bat
  5113.     --- - ---------- ----------    ----------
  5114.      |  |     |          |             |
  5115.      |  |     |          |             |
  5116.      |  |     |          |             `-- DOS command to execute after
  5117.      |  |     |          |                 the extraction has occurred
  5118.      |  |     |          |
  5119.      |  |     |          `-- Name of the file to extract
  5120.      |  |     |
  5121.      |  |     `-- Name of the ARJ archive to use
  5122.      |  |
  5123.      |  `-- Allow user to execute a DOS command
  5124.      |      on selected file(s) in the archive
  5125.      |
  5126.      `-- Launch ARJ.EXE
  5127.  
  5128.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  5129. -!- Terminate 3.00
  5130.  ! Origin: Terminate SmartNote: Remembers & recalls everything! (1:135/71.17)
  5131.  
  5132. ─ Area: Batch Language Programming                     FI ────────────────────
  5133.   Msg#: 442                                          Date: 28 Mar 96  07:31:30
  5134.   From: Vernon Frazee                                Read: Yes    Replied: No
  5135.     To: Otto Lang                                    Mark:
  5136.   Subj: debug or share
  5137. ──────────────────────────────────────────────────────────────────────────────
  5138. OL> ... PPT insists on having SHARE.EXE loaded. I guess because of
  5139. OL> Windows' multitasking?  Anyway, as soon as I added
  5140. OL> INSTALL=C:\DOS\SHARE.EXE to my CONFIG.SYS the next boot hung on
  5141. OL> errors in the debug statement in CURRENT.[BAT]. ... Debug ... errors
  5142. OL> ... trying to load from ... <temptemp.scr.
  5143. OL> :CURRENT.BAT from Fidonet ... BATPOWER. ... Vernon Frazee 01/17/94
  5144.  
  5145.     I'm getting the same results here -- under DOS v6.22.  How about a
  5146.     newer version, GET-DT.BAT (Get Date and Time), that will not only
  5147.     work with SHARE loaded, (and/or should run fine under Windows95),
  5148.     but also sets Day in evar "DY", Month in evar "MM", Day date in evar
  5149.     "DD", Year in evar "YY", Hour in evar "HR", Minute in evar "MN", and
  5150.     Second in evar "SC"?
  5151.  
  5152.     :GET-DT.BAT - Type "GET-DT /?" (not the quotes) for help
  5153.     :Note: Do NOT put a "@echo off" at the beginning of this file!
  5154.     :Begin -------------------------------------------------------
  5155.      @if (%1)==(/?) goto Syntax
  5156.      @if (%1)==(!!) goto GetMDY
  5157.      @if (%1)==(!) prompt set dt=!! $d $t
  5158.      @if (%1)==(!) goto End
  5159.      @echo off
  5160.      for %%x in (dt dy mm dd yy hr mn sc) do set %%x=
  5161.      command /c %0 !>~tmp_01~.bat
  5162.      for %%x in (call del) do %%x ~tmp_01~.bat
  5163.      %0 %dt%
  5164.     :GetMDY ------------------------------------------------------
  5165.      set dt=
  5166.      set DY=%2
  5167.      shift|shift
  5168.      echo;;|choice /c:;%1%; "~tmp_02~ ">~tmp_01~.bat
  5169.      echo set mm=%%2%%3>>~tmp_02~.bat
  5170.      echo set dd=%%5%%6>>~tmp_02~.bat
  5171.      for %%x in (1 2) do echo shift>>~tmp_02~.bat
  5172.      echo set yy=%%8%%9>>~tmp_02~.bat
  5173.      call ~tmp_01~.bat
  5174.     :GetHMS ------------------------------------------------------
  5175.      echo;;|choice /c:;%2%; "~tmp_02~ ">~tmp_01~.bat
  5176.      echo if (%%3)==(:) goto Insert0>~tmp_02~.bat
  5177.      echo set hr=%%2%%3>>~tmp_02~.bat
  5178.      echo set mn=%%5%%6>>~tmp_02~.bat
  5179.      echo set sc=%%8%%9>>~tmp_02~.bat
  5180.      echo goto End>>~tmp_02~.bat
  5181.      echo :Insert0>>~tmp_02~.bat
  5182.      echo set hr=0%%2>>~tmp_02~.bat
  5183.      echo set mn=%%4%%5>>~tmp_02~.bat
  5184.      echo set sc=%%7%%8>>~tmp_02~.bat
  5185.      echo :End>>~tmp_02~.bat
  5186.      for %%x in (call del) do %%x ~tmp_01~.bat
  5187.      del ~tmp_02~.bat
  5188.     :************************************************************:
  5189.     : To display results, change the next line to "goto Display" :
  5190.     :************************************************************:
  5191.      goto End
  5192.     :Syntax ------------------------------------------------------
  5193.      @echo off
  5194.      cls
  5195.      echo     Name: GET-DT.BAT - Get current system Date and Time
  5196.      echo.
  5197.      echo   Author: Vernon Frazee 06/14/94 - (Last mod: 03/28/96)
  5198.      echo.
  5199.      echo  Purpose: Store the current system:
  5200.      echo.
  5201.      echo                Day in evar "DY" (example: DY=Tue)
  5202.      echo              Month in evar "MM" (example: MM=05 )
  5203.      echo           Day date in evar "DD" (example: DD=31 )
  5204.      echo               Year in evar "YY" (example: YY=94 )
  5205.      echo               Hour in evar "HR" (example: HR=06 )
  5206.      echo             Minute in evar "MN" (example: MN=22 )
  5207.      echo             Second in evar "SC" (example: SC=00 )
  5208.      echo.
  5209.      echo   Syntax: [call] [d:[\path]]GET-DT [/?]
  5210.      echo.
  5211.      echo    Where: /? displays this help screen
  5212.      echo.
  5213.      echo Requires: DOS's COMMAND.COM and CHOICE.COM (somewhere in
  5214.      echo           the PATH is fine), and 43 bytes of free space
  5215.      echo           in the environment.
  5216.      echo.
  5217.      echo     Note: "evar" is short for "environment variable".
  5218.      echo.
  5219.      goto End
  5220.     :Display -----------------------------------------------------
  5221.      echo DY=%dy% MM=%mm% DD=%dd% YY=%yy% HR=%hr% MN=%mn% SC=%sc%
  5222.     :End --------------------------------------------------- -vjf-
  5223.  
  5224.     (Note: I would normally test this under Windows95 first for you,
  5225.     but, at the moment I'm at the beach waiting for breakfast to arrive
  5226.     and tapping away on this DOSv6.22/WFWGv3.11 based Laptop. <g>)
  5227.  
  5228.     ./~ She wore an itsy bitsy teeny weeny yellow polka-dot bikini.. ./~
  5229.  
  5230.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  5231. -!- Terminate 3.00
  5232.  ! Origin: The NEW Terminate will -=> FAX <=- almost anything! (1:135/71.17)
  5233.  
  5234. ─ Area: Batch Language Programming                     FI ────────────────────
  5235.   Msg#: 445                                          Date: 28 Mar 96  06:07:54
  5236.   From: Vernon Frazee                                Read: Yes    Replied: No
  5237.     To: Josef Schwartz                               Mark:
  5238.   Subj: how do I...
  5239. ──────────────────────────────────────────────────────────────────────────────
  5240. VF> The following ANSI escape sequence sets the [UpArrow] so it acts
  5241. VF> like a press of the [Enter] key: <-[0;72;"";13p
  5242.   > [snip]
  5243.  
  5244. JS> What would I have to do to switch the ";"  with the ":" ?
  5245.  
  5246.     I used to do that too, years ago, and still have customers
  5247.     occasionally requesting the same.  All it really takes is a couple
  5248.     of escape sequences, (much like the one above), but, instead of
  5249.     trying to explain how to do ANSI escape sequences, I've simply been
  5250.     giving them the enclosed SEMISWAP.BAT along with the following
  5251.  
  5252.     SEMISWAP.BAT Instructions:
  5253.  
  5254.     1) Place a copy of the enclosed SEMISWAP.BAT in a directory in your
  5255.        PATH. (For example, in "C:\BAT").
  5256.  
  5257.     2) Make sure your CONFIG.SYS file has something similar to the
  5258.        following line in it:   DEVICE=C:\DOS\ANSI.SYS
  5259.  
  5260.     3) Insert the following line near the beginning of your AUTOEXEC.BAT
  5261.        file:   CALL C:\BAT\SEMISWAP.BAT /ON
  5262.  
  5263.     4) Reboot and get to the DOS prompt.
  5264.  
  5265.     5) Type "SEMISWAP" (not the quotes) and the current status should be
  5266.        "SEMISWAP=On".  If it is, your ";" and ":" keys should now be
  5267.        swapped.  If not, start back at "1)", making sure sure each and
  5268.        every character is correct and that the "drive:\path\" on each
  5269.        line actually points to the respective file.  (In other words,
  5270.        does the ANSI.SYS file actually exist in directory C:\DOS?; etc.)
  5271.  
  5272. ------------------------------> Cut Here <------------------------------
  5273. @echo off
  5274. :SEMISWAP.BAT - Swaps the ":" and ";" keys, or resets to normal.
  5275.  goto ParmCheck
  5276. :Syntax ----------------------------------------------------------------
  5277.  cls
  5278.  echo     Name: SEMISWAP.BAT (Vernon Frazee 03/11/84, Last Mod 03/28/96)
  5279.  echo.
  5280.  echo  Purpose: Swaps the semi-colon ";" and the colon ":" keys.
  5281.  echo.
  5282.  echo           "/On" = Swapped and "/Off" = Normal
  5283.  echo.
  5284.  echo           In other words, when On or swapped:
  5285.  echo.
  5286.  echo           a) simply pressing the [;] key will now produce the ":"
  5287.  echo              character (instead of having to hold down the [Shift]
  5288.  echo              key and pressing the [;] key to get it).
  5289.  echo.
  5290.  echo           b) and to get the ";" character, you will now have to
  5291.  echo              hold down the [Shift] key and press [;].
  5292.  echo.
  5293.  echo   Syntax: [call] [d:][\path]SEMISWAP [/On (or) /Off (or) /?]
  5294.  echo.
  5295.  echo           SEMISWAP                  - Display current status
  5296.  echo           SEMISWAP /On              - Swap ":" with ";"
  5297.  echo           SEMISWAP /Off             - Return ":" and ";" to normal
  5298.  echo           SEMISWAP /?               - Display this screen
  5299.  echo.
  5300.  echo Requires: DOS' ANSI.SYS (or equivalent) and up to 13 bytes of free
  5301.  echo           environment space.  (Evar SEMISWAP=On or SEMISWAP=Off).
  5302.  goto End
  5303. :ParmCheck -------------------------------------------------------------
  5304.  if (%1)==() goto Display
  5305.  if (%1)==(?) goto Syntax
  5306.  if (%1)==(/?) goto Syntax
  5307.  for %%x in (on On ON oN) do if (%1)==(/%%x) goto On
  5308.  for %%x in (off Off OFf OFF oFF ofF) do if (%1)==(/%%x) goto Off
  5309.  goto Syntax
  5310. :Display status --------------------------------------------------------
  5311.  if (%SEMISWAP%)==() set SEMISWAP=Off
  5312.  echo SEMISWAP=%semiswap%
  5313.  goto End
  5314. :On (Swap the ";" and ":" keys) ----------------------------------------
  5315.  echo  [58;59p [59;58p [1A
  5316.  rem  `-------`-------`------- Three [Esc] characters (Alt-27's)
  5317.  set SEMISWAP=On
  5318.  goto Display
  5319. :Off (Unswap the ";" and ":" keys (back to normal)) --------------------
  5320.  echo  [58;58p [59;59p [1A
  5321.  rem  `-------`-------`------- Three [Esc] characters (Alt-27's)
  5322.  set SEMISWAP=Off
  5323.  goto Display
  5324. :End ------------------------------------------------------------- -vjf-
  5325. ------------------------------> Cut Here <------------------------------
  5326.  
  5327.     6) To view SEMISWAP's brief instructions type:   SEMISWAP /?
  5328.  
  5329.     That's it.  Enjoy!
  5330.  
  5331.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  5332. -!- Terminate 3.00
  5333.  ! Origin: The NEW Terminate will -=> FAX <=- almost anything! (1:135/71.17)
  5334.  
  5335. ─ Area: Batch Language Programming                     FI ────────────────────
  5336.   Msg#: 431             Rec'd                        Date: 01 Apr 96  08:24:39
  5337.   From: Vernon Frazee                                Read: Yes    Replied: No
  5338.     To: Bat Lang                                     Mark:
  5339.   Subj: Echoing redirection chara
  5340. ──────────────────────────────────────────────────────────────────────────────
  5341. VF> Change to the directory containing your SCRipt files and create
  5342. VF> the following 1-line "X.BAT":
  5343. VF>   @debug<%1
  5344. VF> Now type the command:
  5345. VF>   for %x in (*.scr) do call x %x
  5346. VF> and all the SCRipt files in the current directory will be
  5347. VF> processed by DEBUG.
  5348.  
  5349. BL> Vernon, would appreciate a short {^; synopsis that would teach us
  5350. BL> all, the set of circumstances that lead to deciding: when it's
  5351. BL> better/best to use the FOR...IN...DO from the command line, rather
  5352. BL> than including it within a batch file.
  5353. BL> I'm sure we will all be grateful for this poop!  Thanks, and Good
  5354. BL> Modeming!  /\oo/\
  5355.  
  5356.     Hmmm... If it's something that will be used repetitively, I
  5357.     usually wrap a BATch file around it.  For instance, the above
  5358.     might be _quickly_ thrown together as:
  5359.  
  5360.       @echo off
  5361.       :DEBUG'EM.BAT
  5362.        if (%2)==(~!~) goto DoIt
  5363.        for %%x in (*.scr) do call %0 %%x ~!~
  5364.       :DoIt
  5365.        if (%1)==() goto End
  5366.        echo %1
  5367.        debug<%1>nul
  5368.       :End
  5369.  
  5370.     The short solution I gave above must have been because it appeared
  5371.     that the user posing the question needed to do the task but once.
  5372.  
  5373.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  5374. -!- Terminate 3.00
  5375.  ! Origin: Have you ever been TERMINATEd ? (1:135/71.17)
  5376.  
  5377. ─ Area: Batch Language Programming                     FI ────────────────────
  5378.   Msg#: 425                                          Date: 01 Apr 96  16:51:00
  5379.   From: TYRIN PRICE                                  Read: Yes    Replied: No
  5380.     To: INGRID DEKKER                                Mark:
  5381.   Subj: CHOICE
  5382. ──────────────────────────────────────────────────────────────────────────────
  5383. Hi Ingrid!
  5384.  
  5385. ID>Can someone tell me how to use the CHOICE command for more than two options
  5386.  
  5387. ID>list the options right behind the number (ie: 1  start anyprogram) without
  5388. ID>getting the [Y/N] returned from DOS? Or is it enought to just echo the opti
  5389.  
  5390. ID>and set errorlevels without CHOICE?
  5391.  
  5392. CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]
  5393.  
  5394. /C[:]choices Specifies allowable keys. Default is YN
  5395. /N           Do not display choices and ? at end of prompt string.
  5396. /S           Treat choice keys as case sensitive.
  5397. /T[:]c,nn    Default choice to c after nn seconds
  5398. text         Prompt string to display
  5399.  
  5400. ERRORLEVEL is set to offset of key user presses in choices.
  5401.  
  5402. You could TYPE a text file to the screen or ECHO a menu to the screen
  5403. like this...
  5404.  
  5405. ECHO 1) Word Processor
  5406. ECHO 2) Database
  5407. ECHO 3) Spreadsheet
  5408. ECHO 4) Telecommunications
  5409.  
  5410. And then use CHOICE like this
  5411.  
  5412. CHOICE /C1234 /N What'll It Be?
  5413. IF ERRORLEVEL 4 TELIX
  5414. IF ERRORLEVEL 3 LOTUS
  5415. IF ERRORLEVEL 2 DBASE
  5416. IF ERRORLEVEL 1 WP
  5417.  
  5418. -=Ty=-
  5419.  
  5420.  * SLMR 2.1a * BREKFAST.COM halted: cereal port not found.
  5421.  
  5422. -!- GOMail v2.0 [94-0021]
  5423.  ! Origin: The Home of Aunt Gabby (1:123/17)
  5424.  
  5425. ─ Area: Batch Language Programming                     FI ────────────────────
  5426.   Msg#: 444                                          Date: 01 Apr 96  16:33:00
  5427.   From: Roy Reed                                     Read: Yes    Replied: No
  5428.     To: Robert Morton                                Mark:
  5429.   Subj: Unique filenames
  5430. ──────────────────────────────────────────────────────────────────────────────
  5431. I took a beautiful batch file by Vernon Frazee and butchered it to
  5432. get into envars the last digit of the year, one hex letter/number for
  5433. the month, two digits for the day, and the total seconds from the
  5434. current hour, minute and seconds plus offsetting it in an envar called
  5435. addxx.  I didn't go to the extent of saving the filename-base in an
  5436. envar from %1 for you.  Type set to see all.  I now know three tips
  5437. of Frazee's seven million.  Used them here.  Never catch that hummer.
  5438. Just run it to see the stuff in the environment.  You'll need
  5439. CHANGE.COM,
  5440. CHOICE, GWBASIC, and CHANGE.COM.
  5441. ---------------- snip ------------------
  5442.     :MORTON.BAT - Type "MORTON /?" (not the quotes) for help
  5443.     :Note: Do NOT put a "@echo off" at the beginning of this file!
  5444.     :Begin -------------------------------------------------------
  5445.      @if (%1)==(/?) goto Syntax
  5446.      @if (%1)==(!!) goto GetMDY
  5447.      @if (%1)==(!) prompt set dt=!! $d $t
  5448.      @if (%1)==(!) goto plum
  5449.      @echo off
  5450.      for %%x in (dt dy mm dd yy hr mn sc) do set %%x=
  5451.      command /c %0 !>~tmp_01~.bat
  5452.      for %%x in (call del) do %%x ~tmp_01~.bat
  5453.      %0 %dt%
  5454.     :GetMDY ------------------------------------------------------
  5455.      set dt=
  5456.      set DY=%2
  5457.      shift|shift
  5458.      echo;;|choice /c:;%1%; "~tmp_02~ ">~tmp_01~.bat
  5459.      echo set mm=%%2%%3>>~tmp_02~.bat
  5460.      echo set dd=%%5%%6>>~tmp_02~.bat
  5461.      for %%x in (1 2) do echo shift>>~tmp_02~.bat
  5462.      echo set yy=%%9>>~tmp_02~.bat
  5463.      call ~tmp_01~.bat
  5464.     :GetHMS ------------------------------------------------------
  5465.      echo;;|choice /c:;%2%; "~tmp_02~ ">~tmp_01~.bat
  5466.      echo if (%%3)==(:) goto Insert0>~tmp_02~.bat
  5467.      echo set hr=%%2%%3>>~tmp_02~.bat
  5468.      echo set mn=%%5%%6>>~tmp_02~.bat
  5469.      echo set sc=%%8%%9>>~tmp_02~.bat
  5470.      echo goto End>>~tmp_02~.bat
  5471.      echo :Insert0>>~tmp_02~.bat
  5472.      echo set hr=0%%2>>~tmp_02~.bat
  5473.      echo set mn=%%4%%5>>~tmp_02~.bat
  5474.      echo set sc=%%7%%8>>~tmp_02~.bat
  5475.      echo :End>>~tmp_02~.bat
  5476.      for %%x in (call del) do %%x ~tmp_01~.bat
  5477.      del ~tmp_02~.bat
  5478.     :************************************************************:
  5479.     : To display results, change the next line to "goto Display" :
  5480.     :************************************************************:
  5481.      goto End
  5482.     :Syntax ------------------------------------------------------
  5483.      @echo off
  5484.      echo Requires: DOS's COMMAND.COM, CHOICE.COM & CHANGE.COM
  5485.      echo & GWBASIC (somewhere in the PATH is fine)
  5486.      echo.
  5487.      goto plum
  5488.     :Display -----------------------------------------------------
  5489.      echo MM=%mm%=month in hex SS=%ss%=total seconds in time
  5490.      echo (hour,min,sec) YY=%yy%=1 digit for year
  5491.     :End --------------------------------------------------- -vjf-
  5492.     echo ? (%hr%*3600)+(%mn%*60)+(%sc%):system|gwbasic > ~~temp~~.bat
  5493.     echo h$=hex$(%mm%):? h$:system|gwbasic >> ~~temp~~.bat
  5494.     call change.com ~~temp~~.bat 13,10 32
  5495.     for %%x in (dy hr mn sc) do set %%x=
  5496.     call change.com ~~temp~~.bat 79,107,255 "~~^~~"
  5497.     echo set ss=%%3>~~^~~.bat
  5498.     echo set mm=%%8>>~~^~~.bat
  5499.     call ~~temp~~
  5500.     del ~~temp~~.bat
  5501.     del ~~^~~.bat
  5502.     set ymds=%YY%%MM%%DD%%SS%
  5503.     echo;;|choice /c:;%ymds%; "~~~~~ ">~~~~.bat
  5504.     call change ~~~~.bat 91,59,44 ""
  5505.     echo set addxx=%%1%%2%%3%%4%%5%%6%%7%%8.%%9>~~~~~.bat
  5506.     call ~~~~.bat
  5507.     for %%y in (~~~~~ ~~~~) do del %%y.bat
  5508.     :plum
  5509. ---------------- snip ------------------
  5510. You'll have to null out the envars later yourself.
  5511. L8tr.
  5512.  ! Origin: The Bargain Trader BBS *Tampa,FL* (813)249-8595 (1:377/68)
  5513.  
  5514. ─ Area: Batch Language Programming                     FI ────────────────────
  5515.   Msg#: 446                                          Date: 28 Mar 96  21:25:29
  5516.   From: Tony Baechler                                Read: Yes    Replied: No
  5517.     To: Jeff Dubois                                  Mark:
  5518.   Subj: zipping gazillions of text files
  5519. ──────────────────────────────────────────────────────────────────────────────
  5520. |Quoting Jeff to All on 18 Mar 96  23:55:18.|
  5521.  
  5522.  JD> Is there a simply way, via batch, to zip up a gazillion *.TXT files
  5523.  JD> into individual zip files and upon completion then delete all the
  5524.  JD> *.TXT files in that directory?
  5525.  
  5526. I recently discovered a util by Horst in HORST_2.ZIP called LISTMOD.
  5527. COM which sounds like it might work.  You will have to play around
  5528. with this a little, but I think something like this might work.
  5529. @ECHO OFF
  5530. DIR /B|LISTMOD /S. PKZIP $01 $01.$02 >OUT.BAT
  5531. CALL OUT.BAT
  5532.  
  5533. I am sure the following is not quite right, so experimentation is in
  5534. order here.  HORST_2 was sent into BFDS.
  5535. Mail: 1:202/1333 or baechler@crl.com, ftp://ftp.crl.com/users/ba/baechler
  5536.  
  5537. ... Is that your Tagline or did your mail reader throw up?
  5538. -!- Blue Wave/DOS v2.30
  5539.  ! Origin: Total Control BBS (ltd. hours) (1:202/1333)
  5540.  
  5541. ─ Area: Batch Language Programming                     FI ────────────────────
  5542.   Msg#: 447                                          Date: 03 Apr 96  09:12:23
  5543.   From: Vernon Frazee                                Read: Yes    Replied: No
  5544.     To: Bob Morton                                   Mark:
  5545.   Subj: JULIAN DATE 2 ENV
  5546. ──────────────────────────────────────────────────────────────────────────────
  5547. BM> Does anyone have a batch segment that will read today's date and
  5548. BM> convert it to Julian format?
  5549. BM> Actually, I need to build up a filename that is guaranteed to be
  5550. BM> unique every time it is created.  I need to use two characters out
  5551. BM> of the 8.3 format for another purpose, so I have 8.1 left for use.
  5552. BM> I was thinking of YJJJHHMM.SSXX   where XX are the two characters I
  5553. BM> need to use, but as you can see, that's still one character too
  5554. BM> long.  How about converting HHMMSS into relative seconds--a number
  5555. BM> from 1 to 86400?   Hmmmmm..that would do it: changes 6 characters
  5556. BM> (HHMMSS) into 5 digits--YJJJSSSS.SXX
  5557. BM> Guess I'd better not do this arithmetic in batch unless one of the
  5558. BM> frequently mentioned utilities will do it.
  5559.  
  5560.     How about doing it like this:
  5561.  
  5562.     The 1st digit of the filename.  Like you said, use 1 digit for the
  5563.     year -- the last digit.  For example, this is 1996 so it would be a
  5564.     "6". (Of course this means that a decade from now a filename could
  5565.     get overwritten <g>.  I'll come back to this in a sec.).
  5566.  
  5567.     The 2nd digit of the filename.  Use 1 digit for the month -- "1"
  5568.     thru "9" for Jan thru Sep, and then an "A", "B", and "C", for Oct,
  5569.     Nov, and Dec respectively.
  5570.  
  5571.     The 3rd digit of the filename.  Use 1 digit for the day -- "1" thru
  5572.     "9" for the 1st thru the 9th, and then an "A" for the 10th, "B" for
  5573.     the 11th, "C" for the 12th etc. on up thru a "U" for the 31st day of
  5574.     the month.
  5575.  
  5576.     So far then, out of your "8.1" or "9 total digit" specification, we
  5577.     have only used up three digits that cover the Year, Month, and Day.
  5578.     That means we still have 6 digits for the hours, minutes, and
  5579.     seconds.  And, since the hours minutes and seconds are always no
  5580.     more than two digits each, we can now simply use them without having
  5581.     to convert a thing.
  5582.  
  5583.     For example, right now it is   |  And for an example shows what
  5584.     04/03/96 09:39:09 which means  |  happens when the month and day
  5585.     the filename would be:         |  get up into the alphabetical
  5586.                                    |  chars., on 12/31/96 at 23:59:45
  5587.                                    |  the filename would be:
  5588.                                    |
  5589.       64309390.9                   |    6CU23594.5
  5590.       |||||||| |                   |    |||||||| |
  5591.       |||||||` `- Seconds          |    |||||||` `- Seconds
  5592.       |||||``---- Minutes          |    |||||``---- Minutes
  5593.       |||``------ Hours            |    |||``------ Hours
  5594.       ||`-------- Day              |    ||`-------- Day
  5595.       |`--------- Month            |    |`--------- Month
  5596.       `---------- Year             |    `---------- Year
  5597.  
  5598.     (BTW, since "A", "B", "C" etc. come after "1", "2", "3" etc. when
  5599.     sorted alphabetically, a sorted DIRectory listing will have the
  5600.     filenames in sorted by date/time order).
  5601.  
  5602.     Now back to the 10 year thing.  In exactly 10 years from say
  5603.     "12/31/96 at 23:59:45" it would be
  5604.     "12/31/06 at 23:59:45" which, as you can see means that using
  5605.     this approach will result with two identical filenames.  This
  5606.     probably won't be a problem however since most won't keep data
  5607.     files for a decade.  But, if so, one could simply create another
  5608.     subdirectory to keep them in.  Say for instance: C:\1990'S,
  5609.     C:\2000'S, C:\2010'S etc. or C:\1996, C:\1997, . . . whatever).
  5610.  
  5611.     If this approach sounds workable, here's a BATch file that uses
  5612.     QBASIC to create the 8.1 portion of your filename and then sticks it
  5613.     in an environment variable for you -- (so you can then tack on
  5614.     whatever last two digits you want with your BATch file).
  5615.  
  5616.     @echo off
  5617.     :-----------------------------------------------------------------
  5618.     :G9DFN.BAT - Generates a unique 9-Digit left justified 8.1 format
  5619.     :            FileName based on current system date & time.
  5620.     :  Requires: QBASIC (in PATH) and 16 bytes free environment space.
  5621.     :-----------------------------------------------------------------
  5622.      set G9DFN=
  5623.      echo DIM wn(30):FOR x=1 TO 30:READ wn(x):NEXT x>~tmp~.bas
  5624.      echo DATA 49,50,51,52,53,54,55,56,57,65,66,67,68,69,70>>~tmp~.bas
  5625.      echo DATA 71,72,73,74,75,76,77,78,79,80,81,82,83,84,85>>~tmp~.bas
  5626.      echo yy=VAL(MID$(DATE$,10,1)):mm=VAL(MID$(DATE$,1,2))>>~tmp~.bas
  5627.      echo dd=VAL(MID$(DATE$,4,2)):hr$=MID$(TIME$,1,2)>>~tmp~.bas
  5628.      echo mn$=MID$(TIME$,4,2):sc1$=MID$(TIME$,7,1)>>~tmp~.bas
  5629.      echo sc2$=MID$(TIME$,8,1)>>~tmp~.bas
  5630.      echo OPEN "~tmp~.bat" FOR OUTPUT AS #1>>~tmp~.bas
  5631.      echo PRINT #1,"set G9DFN=";CHR$(wn(yy));CHR$(wn(mm));>>~tmp~.bas
  5632.      echo PRINT #1,CHR$(wn(dd));hr$;mn$;sc1$;".";sc2$>>~tmp~.bas
  5633.      echo CLOSE:SYSTEM>>~tmp~.bas
  5634.      qbasic /run ~tmp~.bas
  5635.      del ~tmp~.bas
  5636.      for %%x in (call del) do %%x ~tmp~.bat
  5637.      echo G9DFN=%G9DFN%
  5638.     :End ------------------------------------------------------- -vjf-
  5639.  
  5640.  -- NetMail: 1:135/71    E-Mail: vernon.frazee@71.sunshine.com     -vjf-
  5641. -!- Terminate 3.00
  5642.  ! Origin: Terminate is now specially built for Internet! (1:135/71.17)
  5643.  
  5644. ─ Area: Batch Language Programming                     FI ────────────────────
  5645.   Msg#: 445                                          Date: 04 Apr 96  11:26:51
  5646.   From: Vernon Frazee                                Read: Yes    Replied: No
  5647.     To: Jeff Cole                                    Mark:
  5648.   Subj: Need help with a BAT program
  5649. ──────────────────────────────────────────────────────────────────────────────
  5650. JC> I regularly decode UUENCODED graphics files from an fidoecho. After
  5651. JC> saving the UUCODE posts, I drop to DOS decode the file, and then run
  5652. JC> my graphics program to see what it looks like. My question is, how
  5653. JC> can I call my graphics program and then return to the directory I
  5654. JC> called it from? My guess is something like this:
  5655. JC>   cd < curdir
  5656. JC>   cd c:\graphics\gds
  5657. JC>   gds.exe
  5658. JC>   cd %curdir%
  5659. JC> Would that work?
  5660.  
  5661.     Unfortunately no, but, it really isn't much more complicated than
  5662.     that.  Here, try it like this:
  5663.  
  5664.       @echo off
  5665.       :GDS.BAT - Loads GDS and returns to current dir
  5666.       :Save current drive:\dir -----------------------
  5667.        echo @prompt cd $p$_$n:>%temp%\~tmp~.bat
  5668.        %comspec% /c %temp%\~tmp~.bat>%temp%\return.bat
  5669.        del %temp%\~tmp~.bat
  5670.       :Load GDS --------------------------------------
  5671.        for %%x in (c: cd\graphics\gds) do %%x
  5672.        gds.exe %1 %2 %3 %4 %5 %67 %7 %8 %9
  5673.       :Return to saved drive:\dir --------------------
  5674.        for %%x in (call del) do %%x %temp%\return.bat
  5675.       :End -------------------------------------------
  5676.  
  5677.     Note: The five lines beginning with ":" can be removed if you like.
  5678.  
  5679.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  5680. -!- Terminate 3.00
  5681.  ! Origin: Terminate is now specially built for Internet! (1:135/71.17)
  5682.  
  5683. ─ Area: Batch Language Programming                     FI ────────────────────
  5684.   Msg#: 422                                          Date: 04 Apr 96  22:37:05
  5685.   From: James Hill                                   Read: Yes    Replied: No
  5686.     To: MIKE DUTTERA                                 Mark:
  5687.   Subj: Get date?
  5688. ──────────────────────────────────────────────────────────────────────────────
  5689. In a msg on <Mar 05 09:45>, MIKE DUTTERA of 1:270/616 writes:
  5690.  
  5691. SH>>What I'd like to do is have a plain vanilla batch file that
  5692. SH>>grabs the day of the month so that on the 3rd, for example, I
  5693. SH>>could defrag my HD, on the 4th run scandisk, etc. etc.
  5694.  
  5695. SH>>I figure it would have to be something that grabs the day of
  5696. SH>>the month as an env variable then the calling batch files
  5697. SH>>would check this to see if its the right day.
  5698.  
  5699.  MD> Piece 'o cake. Just use MS-DOS's DATE and FIND functions in a
  5700.  MD> batch using the general form:
  5701.  
  5702.  MD> DATE|FIND "-03-"
  5703.  MD> IF ERRORLEVEL 0 IF NOT ERRORLEVEL 1 GOTO BLAHBLAH
  5704.  
  5705. or you could have done;
  5706.  
  5707. echo.|date|find "-03-"|if not errorlevel 1 defrag c: /f /h /sn
  5708. echo.|date|find "-04-"|if not errorlevel 1 scandisk c: /autofix
  5709.  
  5710. enjoy.
  5711.  
  5712. -!- msgedsq 2.1
  5713.  ! Origin: Selective On-Line (tm) - Santa Fe, NM - (505) 473-9765 - (1:15/11)
  5714.  
  5715. ─ Area: Batch Language Programming                     FI ────────────────────
  5716.   Msg#: 424                                          Date: 25 Mar 96  19:04:40
  5717.   From: Michael Marquart                             Read: Yes    Replied: No
  5718.     To: Paul Laufer                                  Mark:
  5719.   Subj: Strip .EXT from command line
  5720. ──────────────────────────────────────────────────────────────────────────────
  5721.  ~~ Paul Laufer said to All ~~
  5722.  ~~ Regarding Strip .EXT from command line ~~
  5723.  ~~ on 17 Mar 96  22:27:58 ~~
  5724.  
  5725.  Hi Paul!
  5726.  
  5727.  PL> TESTBAT.BAT C:\PATH\FILE.EXT
  5728.  
  5729.  PL> ...I would like this batch file to know that this is an (EXT) file
  5730.  PL> and "GOTO EXT".  Then I could process the file as a .EXT file.
  5731.  PL> If it's a .ZIP file it would "GOTO ZIP" in the batch process and
  5732.  PL> I could process it as a .ZIP file.
  5733.  
  5734.  Try this: tested on MSDOS V6.22 and uses only command.com.
  5735.  
  5736.  :: Call_me_what_you_will.bat ===========================================
  5737.  @echo off
  5738.  set exten=%1
  5739.  :nextchar
  5740.  set prev=%exten%
  5741.  for %%f in (/%exten%) do set exten=%%f
  5742.  if ".%exten%"=="%prev%" goto extfound
  5743.  if not "%exten%"=="%prev%" goto nextchar
  5744.  echo There was no extension given on the command line for the filename!
  5745.  goto end
  5746.  
  5747.  :extfound
  5748.  echo Extension is %prev%
  5749.  for %%f in (/%prev%) do set ext=%%f
  5750.  echo going to label %ext%
  5751.  goto %ext%
  5752.  
  5753.  :bat
  5754.  echo :bat
  5755.  goto end
  5756.  
  5757.  :com
  5758.  echo :com
  5759.  goto end
  5760.  
  5761.  :exe
  5762.  echo :exe
  5763.  goto end
  5764.  
  5765.  :txt
  5766.  echo :txt
  5767.  goto end
  5768.  
  5769.  :end
  5770.  for %%f in (ext prev exten) do set %%f=
  5771.  ::======================================================================
  5772.  
  5773.  The method was ripped off err... borrowed from one of the good denizens of
  5774.  this echo!
  5775.  
  5776.  Regards
  5777.                Mic
  5778.  
  5779.  
  5780. ... Clowns to the left of me, jokers to the right...
  5781. -!-
  5782.  ! Origin: Melbourne PC User Group  +61-3-9699-6788 (3:632/309)
  5783.  
  5784. ─ Area: Batch Language Programming                     FI ────────────────────
  5785.   Msg#: 445                                          Date: 07 Apr 96  06:43:35
  5786.   From: Vernon Frazee                                Read: Yes    Replied: No
  5787.     To: Osgar Schaedtler                             Mark:
  5788.   Subj: FIND, DELETE and FC
  5789. ──────────────────────────────────────────────────────────────────────────────
  5790. OS> I've made a file, named FILE1.TXT, made with the command:
  5791. OS>   DIR /B /A-D >FILE1.TXT
  5792. OS> Now I want to make a program that will do the following thing:
  5793. OS> The files in that directory have to be compared with the file
  5794. OS> FILE1.TXT. If there are some different files between the files in
  5795. OS> the directory and the files in FILE1.TXT, then I want to delete
  5796. OS> these files out of the directory.  Has somebody an idea?  I've
  5797. OS> tried something with the commands FIND and FC, but that didn't
  5798. OS> work. So, help me please!
  5799.  
  5800.     There is an easier way.  All it takes is one "for in do" command.
  5801.  
  5802.     Let's say you have two directories.  One named MASTER containing the
  5803.     files you want to compare to, and another named FOOBAR that contains
  5804.     a few files that are named the same as well as some extra junk files
  5805.     that you want to get rid of.  For example:
  5806.  
  5807.     =================================+==================================
  5808.     Directory of C:\MASTER           | Directory of C:\FOOBAR
  5809.                                      |
  5810.     1    TXT       0 04-07-96   6:45a| 1    TXT       0 04-07-96   6:45a
  5811.     2    TXT       0 04-07-96   6:45a| 2    TXT       0 04-07-96   6:45a
  5812.     3    TXT       0 04-07-96   6:45a| 3    TXT       0 04-07-96   6:45a
  5813.                                      | 4    TXT       0 04-07-96   6:45a
  5814.                                      | 5    TXT       0 04-07-96   6:45a
  5815.     =================================+==================================
  5816.  
  5817.     (IOW, we want to get rid of "4.TXT" and "5.TXT" in C:\FOOBAR).
  5818.  
  5819.     All it takes to do this is one DEL command.
  5820.  
  5821.     First change to the directory that contains the files you want to
  5822.     get rid of -- which in our example here is C:\FOOBAR.  Now type the
  5823.     following command at the DOS prompt:
  5824.  
  5825. -->   for %x in (*.*) do if not exist c:\master\%x del %x
  5826.  
  5827.     And that's it, you'll now have:
  5828.  
  5829.     =================================+==================================
  5830.     Directory of C:\MASTER           | Directory of C:\FOOBAR
  5831.                                      |
  5832.     1    TXT       0 04-07-96   6:45a| 1    TXT       0 04-07-96   6:45a
  5833.     2    TXT       0 04-07-96   6:45a| 2    TXT       0 04-07-96   6:45a
  5834.     3    TXT       0 04-07-96   6:45a| 3    TXT       0 04-07-96   6:45a
  5835.     =================================+==================================
  5836.  
  5837.     Pretty "Kewl!" eh?  <g>
  5838.  
  5839.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  5840. -!- Terminate 3.00
  5841.  ! Origin: Terminate point system (1:135/71.17)
  5842.  
  5843. ─ Area: Batch Language Programming                     FI ────────────────────
  5844.   Msg#: 446                                          Date: 09 Apr 96  22:54:00
  5845.   From: Benjamin L Mcgee                             Read: Yes    Replied: No
  5846.     To: All                                          Mark:
  5847.   Subj: CHEESY WINDOWS ENVIRON
  5848. ──────────────────────────────────────────────────────────────────────────────
  5849. Here's a little somethin' I came up with so I can safely run
  5850. Binkley Term under Windows (so I can play Comet Busters while I
  5851. download QWK packets).  It just prevents me from running Bink
  5852. twice which causes all sorts of problems, and it compensates for
  5853. the lack of a true environment variable under Windows.  An old
  5854. trick I'm sure but I thought it might be helpful.
  5855.  
  5856. @echo off
  5857. cls
  5858. if exist c:\binkley\~windows.var goto error
  5859.  
  5860. :: set a HARD environment variable
  5861.    rem > c:\binkley\~windows.var
  5862.  
  5863. :dumb
  5864. :: truncate log file
  5865.    rem > c:\binkley\binkley.log
  5866.  
  5867. :: load vfos
  5868.    c:\binkley\vfoss\vfos_ibm
  5869.    c:
  5870.    cd \binkley
  5871.    bt.exe
  5872.  
  5873. :: unload vfos
  5874.    c:\binkley\vfoss\vfos_del
  5875.    del c:\binkley\~windows.var
  5876.    goto quit
  5877.  
  5878. :error
  5879.    echo.
  5880.    echo      Binkley Term is already running!
  5881.    echo Running Bink twice under Windows is NOT good!
  5882.    choice /cyn Do you wish to run Bink again anyway [Y/N]?
  5883.    if errorlevel 2 goto quit
  5884.    if errorlevel 1 goto dumb
  5885.  
  5886. :quit
  5887. Benjamin L McGee on 1:15/7
  5888.  
  5889. *Drop that pickle.
  5890.  
  5891. -!- FLAME v1.1
  5892.  ! Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
  5893.  
  5894. ─ Area: Batch Language Programming                     FI ────────────────────
  5895.   Msg#: 416                                          Date: 11 Apr 96  02:47:12
  5896.   From: Vernon Frazee                                Read: Yes    Replied: Yes
  5897.     To: All                                          Mark:
  5898.   Subj: AVGFILES.BAT
  5899. ──────────────────────────────────────────────────────────────────────────────
  5900.     Hello all,
  5901.  
  5902.     I'd sure appreciate if some of you running on MS-DOS 6.nn would run
  5903.     the following and report back the resultant "average number of files
  5904.     per directory" on your systems.
  5905.  
  5906.     @echo off
  5907.     :AVGFILES.BAT ------------------------------------------------------
  5908.      goto Begin
  5909.     :Syntax ------------------------------------------------------------
  5910.      echo.
  5911.      echo     Name: AVGFILES.BAT v1.00
  5912.      echo   Author: Vernon Frazee 04/09/96
  5913.      echo  Purpose: Calculate the average number of files
  5914.      echo           per directory for the drive specified.
  5915.      echo   Syntax: AVGFILES d:
  5916.      echo    Where: "d:" is the drive to check
  5917.      echo Requires: DOS' CHKDSK, FIND and QBASIC
  5918.      echo           (anywhere in PATH is fine).
  5919.      echo    Notes: Specified drive must contain at least one
  5920.      echo           directory and one file in the root directory.
  5921.      echo           Hidden files are NOT included.
  5922.      echo           Has only been tested on MS-DOS v6.nn
  5923.      echo.
  5924.      goto End
  5925.     :Begin -------------------------------------------------------------
  5926.      if (%1)==() goto Syntax
  5927.      if not exist %1\nul goto DriveErr
  5928.      if not exist %1\*.* goto FileErr
  5929.      dir %1|find "DIR"|find "        ">~tmp_01~.dat
  5930.      copy ~tmp_01~.dat+,,>nul
  5931.      if not exist ~tmp_01~.dat goto DirErr
  5932.     :Gather data on specified drive ------------------------------------
  5933.      echo.
  5934.      echo Counting files and directories on drive "%1" ...
  5935.      echo.
  5936.      chkdsk %1|find /v "a"|find "in"|find /v "dd">~tmp_01~.dat
  5937.     :Display CHKDEK data -----------------------------------------------
  5938.      echo CHKDSK data for drive "%1"
  5939.      echo.
  5940.      type ~tmp_01~.dat
  5941.      echo.
  5942.     :Create QBASIC program to do the calculations ----------------------
  5943.      echo OPEN "~tmp_01~.dat" FOR INPUT AS #1>~tmptmp~.bas
  5944.      echo OPEN "~tmp_02~.dat" FOR OUTPUT AS #2>>~tmptmp~.bas
  5945.      echo DO WHILE NOT EOF(1)>>~tmptmp~.bas
  5946.      echo   LINE INPUT #1, Rec$>>~tmptmp~.bas
  5947.      echo   Rec$ = MID$(Rec$, 24, 18)>>~tmptmp~.bas
  5948.      echo     FOR Count = 1 TO 18>>~tmptmp~.bas
  5949.      echo       IF MID$(Rec$, Count, 1) = "," THEN>>~tmptmp~.bas
  5950.      echo         Stn$ = "">>~tmptmp~.bas
  5951.      echo       END IF>>~tmptmp~.bas
  5952.      echo       IF NOT MID$(Rec$, Count, 1) = "," THEN>>~tmptmp~.bas
  5953.      echo         Stn$ = MID$(Rec$, Count, 1)>>~tmptmp~.bas
  5954.      echo       END IF>>~tmptmp~.bas
  5955.      echo       IF UCASE$(Stn$) = LCASE$(Stn$) THEN>>~tmptmp~.bas
  5956.      echo         x$ = x$ + Stn$>>~tmptmp~.bas
  5957.      echo       END IF>>~tmptmp~.bas
  5958.      echo     NEXT Count>>~tmptmp~.bas
  5959.      echo   PRINT #2, x$>>~tmptmp~.bas
  5960.      echo   x$ = "">>~tmptmp~.bas
  5961.      echo LOOP>>~tmptmp~.bas
  5962.      echo CLOSE>>~tmptmp~.bas
  5963.      echo OPEN "~tmp_02~.dat" FOR INPUT AS #1>>~tmptmp~.bas
  5964.      echo LINE INPUT #1, d$: LINE INPUT #1, f$>>~tmptmp~.bas
  5965.      echo a = CSNG(VAL(f$) / VAL(d$))>>~tmptmp~.bas
  5966.      echo a$ = LTRIM$(RTRIM$(STR$(a)))>>~tmptmp~.bas
  5967.      echo PRINT "Average number of files";>>~tmptmp~.bas
  5968.      echo PRINT " per directory: "; a$>>~tmptmp~.bas
  5969.      echo CLOSE : SYSTEM>>~tmptmp~.bas
  5970.     :Run QBASIC program ------------------------------------------------
  5971.      qbasic /run ~tmptmp~.bas
  5972.      echo.
  5973.      goto Cleanup
  5974.     :DriveErr ----------------------------------------------------------
  5975.      echo.
  5976.      echo    Error: Drive "%1" is not a valid drive
  5977.      goto Syntax
  5978.     :FileErr -----------------------------------------------------------
  5979.      echo.
  5980.      echo    Error: Drive "%1" must contain at least
  5981.      echo           one file in the root directory
  5982.      goto Syntax
  5983.     :DirErr ------------------------------------------------------------
  5984.      echo.
  5985.      echo    Error: Drive "%1" must contain at least
  5986.      echo           one subdirectory
  5987.      goto Syntax
  5988.     :Cleanup -----------------------------------------------------------
  5989.      for %%x in (1 2) do del ~tmp_0%%x~.dat
  5990.      del ~tmptmp~.bas
  5991.     :End --------------------------------------------------------- -vjf-
  5992.  
  5993.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  5994.  
  5995. -!- OLMS 2.53p+ [ERSBN55C]
  5996.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  5997.  
  5998. ─ Area: Batch Language Programming                     FI ────────────────────
  5999.   Msg#: 418                                          Date: 09 Apr 96  08:23:00
  6000.   From: Horst Schaeffer                              Read: Yes    Replied: No
  6001.     To: Scott Sellars                                Mark:
  6002.   Subj: Batch File Help...
  6003. ──────────────────────────────────────────────────────────────────────────────
  6004. -=> quoting Scott Sellars to Clay Cherneff (5 Apr 96) <=-
  6005.  
  6006. SS> I want to generate errorlevels so i can test out my batch files.
  6007.  
  6008. some errorlevel test tools:
  6009. -+-+-----
  6010. n EL!.COM
  6011. e100 BE 81 0 AC "< t"FB "N<0r"1B "+"C0 "*"FF BA A 0 8A 1C "F"80 EB "0"
  6012. e11A ":"DA "s"6 F7 E2 1 D8 "s"ED B4 "L"CD "!"BA "3"1 B4 9 CD "!*"C0 EB
  6013. e132 F1 "EL! n"D A "sets errorlevel to n=0..255"D A "$"
  6014. rCX
  6015. 58
  6016. w
  6017. q
  6018. -+-+-----
  6019. Cut out and save (any filename), then run:  DEBUG < filename
  6020.  
  6021. -+-+-.... and to display the errorlevel:
  6022. @echo off
  6023. :: return errorlevel EL & echo
  6024. set !=
  6025. set EL=
  6026. for %%h in (0 1 2) do if errorlevel %%h00 set EL=%%h
  6027. if not errorlevel 200 set !=6 7 8 9
  6028. for %%t in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%t0 set EL=%EL%%%t
  6029. if not errorlevel 250 set !=6 7 8 9
  6030. for %%u in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%u set EL=%EL%%%u
  6031. echo Errorlevel %EL%
  6032. set !=
  6033. -+-+-
  6034.  
  6035. Horst.
  6036.  
  6037. ... Q4FM 2.10 ... horst@confusion.rmc.de
  6038.  
  6039. -!- FM 2.02 / ScanToss
  6040.  ! Origin: Don't follow leaders! (2:2480/13.75)
  6041.  
  6042. ─ Area: Batch Language Programming                     FI ────────────────────
  6043.   Msg#: 446                                          Date: 14 Apr 96  20:48:00
  6044.   From: Benjamin L Mcgee                             Read: Yes    Replied: No
  6045.     To: Jay Fuller                                   Mark:
  6046.   Subj: QUESTION CONCERNING "FIND
  6047. ──────────────────────────────────────────────────────────────────────────────
  6048.  On 04-09-96 JAY FULLER wrote to ALL...
  6049.  
  6050.  JF> Greetings everyone,
  6051.  
  6052. Hello!
  6053.  
  6054.  JF> I'm attempting to write a batch file that will do the
  6055.  JF> following.....
  6056.  JF> if find log.txt "SUCCESS" goto success
  6057.  JF> if find log.txt "ILLEGAL" goto illegal
  6058.  
  6059. Do you program in 'C' or 'C++'?  DOS's IF just ain't that good.
  6060.  
  6061.  added /i to ignore case
  6062.  added > nul to hide output of find
  6063.  find returns errorlevel 2 if an error occured while trying
  6064.  to read from the file, errorlevel 1 if no error occured but the
  6065.  search string wasn't found, and errorlevel 0 if no error occured
  6066.  and the search string was found
  6067.  
  6068. find /i "SUCCESS" LOG.TXT > nul
  6069.      if errorlevel 2 goto error
  6070.      if not errorlevel 1 goto success
  6071. find /i "ILLEGAL" LOG.TXT > nul
  6072.      if errorlevel 2 goto error
  6073.      if not errorlevel 1 goto illegal
  6074.  
  6075. Benjamin L McGee on 1:15/7
  6076.  
  6077. *Don't read everything you believe.
  6078.  
  6079. -!- FLAME v1.1
  6080.  ! Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
  6081.  
  6082. ─ Area: Batch Language Programming                     FI ────────────────────
  6083.   Msg#: 439                                          Date: 16 Apr 96  21:16:19
  6084.   From: Vernon Frazee                                Read: Yes    Replied: No
  6085.     To: Kenny Eschrich                               Mark:
  6086.   Subj: old tandy-autoexec
  6087. ──────────────────────────────────────────────────────────────────────────────
  6088. KE> I've got a real old Tandy 1000.  In order to use the disk drive, i
  6089. KE> have to type F3 before it says Starting IB DOS.  Is there any way
  6090. KE> i can do this automatically in like my autoexec or config or
  6091. KE> whatever?
  6092.  
  6093.     Press the [F3] function key?  I don't believe I've ever heard of
  6094.     that one.  Maybe it will only boot from ROM (Read-Only Memory)?
  6095.  
  6096.     Anyway, in answer to your question, probably not.  When you see:
  6097.  
  6098.       Starting MS-DOS ...
  6099.  
  6100.     nothing in CONFIG.SYS has even been processed yet.  The processing
  6101.     steps involved in a 'normal' MS-DOS startup is as follows:
  6102.  
  6103.     :Begin
  6104.  
  6105.     1) ROM program loads the bootstrap program from disk
  6106.  
  6107.     2) Bootstrap loads hidden system files and passes control to them
  6108.  
  6109.     3) ROM programs and the DOS BIOS combine to produce the I/O code
  6110.  
  6111.     4) DOS system generation begins
  6112.  
  6113.     5) Does CONFIG.SYS exist?
  6114.  
  6115.        No  - use default DOS values and goto "6)"
  6116.  
  6117.        Yes - modify DOS default parameters and install user-specified
  6118.              device drivers
  6119.  
  6120.     6) Is the command processor COMMAND.COM?
  6121.  
  6122.        No -  Invoke startup portion of the command processsor and
  6123.              goto "End"
  6124.  
  6125.        Yes - Invoke startup portion of COMMAND.COM
  6126.  
  6127.     7) Is AUTOEXEC.BAT present?
  6128.  
  6129.        No  - Issue DOS Date and Time commands and goto "End"
  6130.  
  6131.        Yes - Perform the commands in AUTOEXEC.BAT
  6132.  
  6133.     8) Terminate the startup portion of COMMAND.COM
  6134.  
  6135.     :End
  6136.  
  6137.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6138.  
  6139. -!- OLMS 2.53p+ [ERSBN55C]
  6140.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  6141.  
  6142. ─ Area: Batch Language Programming                     FI ────────────────────
  6143.   Msg#: 435                                          Date: 13 Apr 96  17:57:22
  6144.   From: Geoff Cutter                                 Read: Yes    Replied: No
  6145.     To: Bob Morton                                   Mark:
  6146.   Subj: Unique file name - was JULIAN DATE 2 ENV
  6147. ──────────────────────────────────────────────────────────────────────────────
  6148. On 07 Apr 96  10:12:00, Bob Morton wrote to Geoff Cutter
  6149.  
  6150.  BM> Unfortunately, I need granularity finer than "minute."  It is possible
  6151.  BM> two files will be created within the same minute, which would result
  6152.  BM> in identical filenames.
  6153. Perhaps reserve a character for incrementing:
  6154.  
  6155.   set jj=0
  6156.   :again
  6157.   REM  increment here
  6158.   if exist xxxxxxxx.xx%jj% goto again
  6159.   REM unique name found
  6160.  
  6161. Several programs can increment - any of these:
  6162.  
  6163.    BATCHMAN LZH     46761 10/03/94   23:13
  6164.    FDATE91C ZIP     76262 23/10/95    1:56
  6165.    GET27    ZIP    117869 31/05/95   19:41
  6166.    INCVAR   LZH      7598 27/11/93   19:08
  6167.    PSIS-500 LZH     22972 15/05/95    5:00
  6168.  
  6169. or you could modify Vernon's batch program:
  6170.  
  6171. Date: 07 Apr 94  03:04:11
  6172. From: Vernon Frazee
  6173. Subj: Auto Backups
  6174.  
  6175.     The following COUNT.BAT will keep track of how many times it has
  6176.     been run.  Change ALL of the "c:\bat" 's to the name of your
  6177.     BATch file directory on your system.  (Must be in your PATH too).
  6178.  
  6179. @echo off
  6180. :COUNT.BAT - Increments the COUNT each time run - (Self modifying!) ----
  6181.  if not (%1)==(/?) goto BEGIN
  6182.  echo Syntax: COUNT [/0]                (Optional "/0" means initialize)
  6183.  goto END
  6184. :BEGIN -----------------------------------------------------------------
  6185.  set count=1
  6186.  if not (%1)==(/0) goto COUNT
  6187. :Initialize ------------------------------------------------------------
  6188.  find /v ":%count%"<c:\bat\count.bat>c:\bat\count.bat
  6189.  goto END
  6190. :COUNT -----------------------------------------------------------------
  6191.  echo :%count%>>c:\bat\count.bat
  6192.  find /c ":%count%" c:\bat\count.bat>countemp.bat
  6193.  echo set count=%%2>--------.bat
  6194.  for %%x in (call del) do %%x countemp.bat
  6195.  del --------.bat
  6196.  set count=%count%
  6197. :END (Note: COUNT.BAT data storage below) ------------------------ -vjf-
  6198.  
  6199.     The following example, W.BAT, uses the above COUNT.BAT to keep track
  6200.     of how many times it has been run.  Change whatever you like to suit
  6201.     your specific requirements:
  6202.  
  6203. @echo off
  6204. :W.BAT - Loads WORD each time run and also does a "modified
  6205. :        files only" backup to drive B: every 30th time run.
  6206. :Notes - Requires COUNT.BAT and DOS's XCOPY both be available
  6207. :        somewhere in current PATH.
  6208. :Begin --------------------------------------------------------
  6209.  echo Loading: WORD ...
  6210.  c:
  6211.  cd\word
  6212.  word
  6213.  call count
  6214.  echo.
  6215.  echo Word has been run %count% times since last backup to B:
  6216.  if not (%count%)==(30) goto DONE
  6217. :Backup -------------------------------------------------------
  6218.  echo.
  6219.  echo Please insert your "Word Backup Diskette" in drive
  6220.  echo B: and press any key to begin copying file(s). . .
  6221.  echo.
  6222.  pause>nul
  6223.  xcopy c:\word b:\ /m /s /e
  6224.  call count /0
  6225. :DONE ---------------------------------------------------------
  6226.  cd\
  6227.  echo.
  6228. :End ---------------------------------------------------- -vjf-
  6229.  
  6230.  
  6231. regds   Geoff
  6232.  
  6233.  
  6234. -!- Blue Wave/DOS v2.30
  6235.  ! Origin: TARDIS BBS (03) 9819 7093 (3:633/260)
  6236.  
  6237. ─ Area: Batch Language Programming                     FI ────────────────────
  6238.   Msg#: 435                                          Date: 23 Apr 96  11:26:07
  6239.   From: Vernon Frazee                                Read: Yes    Replied: No
  6240.     To: Roy Reed                                     Mark:
  6241.   Subj: DECIMAL TO HEX
  6242. ──────────────────────────────────────────────────────────────────────────────
  6243. RR> Here is a decimal to hex converter, but it's 400 some bytes.
  6244. RR> -+-+--------------------------------------------------------
  6245. RR> n BREAKOUT.LZH
  6246. RR> e100 FC "+"ED BE 82 1 B9 80 FD B4 "?U[VZ"CD "!r`PY"F7 D8 99 ...
  6247.  
  6248.     How about a simple BATch-file/QBASIC solution:
  6249.  
  6250.     @echo off
  6251.     :HEX.BAT ----------------------------------------------
  6252.      if (%1)==() goto Syntax
  6253.      if (%1)==(/?) goto Syntax
  6254.     :Begin ------------------------------------------------
  6255.      echo A$=HEX$(%1):? A$:system>~tmptmp~.bas
  6256.      qbasic /run ~tmptmp~.bas
  6257.      del ~tmptmp~.bas
  6258.      goto End
  6259.     :Syntax -----------------------------------------------
  6260.      echo Syntax: HEX nnn
  6261.      echo  Where:     nnn is a Decimal number that you want
  6262.      echo                 converted to a Hexadecimal number
  6263.      echo   Note:     nnn can be up to nine 9's worth.
  6264.     :End -------------------------------------------- -vjf-
  6265.  
  6266.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6267.  
  6268. -!- OLMS 2.53p+ [ERSBN55C]
  6269.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  6270.  
  6271. ─ Area: Batch Language Programming                     FI ────────────────────
  6272.   Msg#: 443                                          Date: 23 Apr 96  11:26:06
  6273.   From: Vernon Frazee                                Read: Yes    Replied: No
  6274.     To: Malcolm Campbell                             Mark:
  6275.   Subj: JULIAN DATE 2 ENV
  6276. ──────────────────────────────────────────────────────────────────────────────
  6277. AG> In a message originally to Malcolm Campbell, Vernon Frazee said:
  6278. AG> :ZIPLOG.BAT - Change to the directory containing the .LOG file(s)
  6279. AG> to ZIP and type "ZIPLOG" (no quotes).
  6280.  
  6281. MC> I seem to have missed this   ;-(     Can you please repost?
  6282.  
  6283.     Here you go:
  6284.  
  6285.     :ZIPLOG.BAT - Change to the directory containing the .LOG
  6286.     :             file(s) to ZIP and type "ZIPLOG" (no quotes).
  6287.     :Note: Do NOT put a "@echo off" at the beginning of this file!
  6288.     :Begin -------------------------------------------------------
  6289.      @if (%1)==(/?) goto Syntax
  6290.      @if (%1)==(!!) goto GetMDY
  6291.      @if (%1)==(!) prompt set date=!! $d
  6292.      @if (%1)==(!) goto End
  6293.      @echo off
  6294.      for %%x in (date mm dd yy) do set %%x=
  6295.      command /c %0 !>~tmp_01~.bat
  6296.      for %%x in (call del) do %%x ~tmp_01~.bat
  6297.      %0 %date%
  6298.     :GetMDY ------------------------------------------------------
  6299.      shift|shift
  6300.      echo;;|choice /c:;%1%; "~tmp_02~ ">~tmp_01~.bat
  6301.      echo set mm=%%2%%3>>~tmp_02~.bat
  6302.      echo set dd=%%5%%6>>~tmp_02~.bat
  6303.      for %%x in (1 2) do echo shift>>~tmp_02~.bat
  6304.      echo set yy=%%8%%9>>~tmp_02~.bat
  6305.      for %%x in (call del) do %%x ~tmp_01~.bat
  6306.      del ~tmp_02~.bat
  6307.     :Zip'em ------------------------------------------------------
  6308.      pkzip -ex %yy%%mm%%dd% *.LOG
  6309.      dir %yy%%mm%%dd%.zip
  6310.     :Cleanup -----------------------------------------------------
  6311.      for %%x in (date mm dd yy) do set %%x=
  6312.     :End ---------------------------------------------------------
  6313.  
  6314.     Requires CHOICE.COM and maybe 30 bytes free environment space.
  6315.  
  6316. MC> Thanks!
  6317.  
  6318.     Sure; no problem.
  6319.  
  6320.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6321.  
  6322. -!- OLMS 2.53p+ [ERSBN55C]
  6323.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  6324.  
  6325. ─ Area: Batch Language Programming                     FI ────────────────────
  6326.   Msg#: 444                                          Date: 25 Apr 96  17:25:00
  6327.   From: Ron Warder                                   Read: Yes    Replied: No
  6328.     To: Jerry Dugal                                  Mark:
  6329.   Subj: count lines in txt file
  6330. ──────────────────────────────────────────────────────────────────────────────
  6331.  >I need to count the # of lines in a txt file, any one have an idea on the
  6332.  >best way to go about doing this?
  6333.  
  6334.  Here ya go, courtesy of Prof. Timo Salmi, Finlands resident DOS guru:
  6335.  
  6336.    :: LC.BAT -----------------------------------------------------------
  6337.    @echo off
  6338.    echo +---------------------------------------------------+
  6339.    echo . Count the number of lines in the given TEXT file  .
  6340.    echo . By Prof. Timo Salmi, ts@chyde.uwasa.fi, 6-Dec-91  .
  6341.    echo +---------------------------------------------------+
  6342.  
  6343.    rem If no parameters then give the instructions
  6344.    if "%1"=="" goto _help
  6345.  
  6346.    rem Check that the file exists
  6347.    if not exist %1 goto _nofind
  6348.  
  6349.    rem Count the lines
  6350.   :: Note: As posted in TSBATxx.ZIP, the line below has an error in the
  6351.   :: find string. The single "%" should have been "%%", since the single
  6352.   :: percent sign is absorbed by DOS's batch handler.
  6353.   :: find /v /c "2O4$fD%h38+" %1
  6354.    find /v /c "2O4$fD%%h38+" %1
  6355.    goto _out
  6356.  
  6357.    :_help
  6358.    echo.
  6359.    echo Usage: LC FileName
  6360.    goto _out
  6361.  
  6362.    :_nofind
  6363.    echo.
  6364.    echo File %1 not found
  6365.    goto _out
  6366.  
  6367.    :_out
  6368.    echo on
  6369.    :: End of LC.BAT ----------------------------------------------------
  6370.  
  6371.   This gives you a count of the number of lines in the specified file by
  6372. telling you how many lines -don't- contain the string "2O4$fD%%h38+". Any
  6373. string will work, so long as it is unique enough to -not- appear in the file
  6374. specified. The string given is as unique as any that I have ever come up with.
  6375. If the file being operated on contains that particular string, the result from
  6376. LC.BAT will be off by the number of lines that contain the search string.
  6377.  
  6378.   Hope this helps solve the problem ....
  6379.  
  6380.  
  6381.  
  6382.  
  6383. -!- SLMAIL v4.0a  (#0304)
  6384.  ! Origin: Free Spirit =*= SL/RIP =*= 301-283-0917 =*= V32b/HST (1:109/132)
  6385.  
  6386. ─ Area: Batch Language Programming                     FI ────────────────────
  6387.   Msg#: 437                                          Date: 24 Apr 96  20:57:24
  6388.   From: Larry Nelson                                 Read: Yes    Replied: No
  6389.     To: Bill Martin                                  Mark:
  6390.   Subj: For/in/Do ?
  6391. ──────────────────────────────────────────────────────────────────────────────
  6392.          BILL:
  6393.  
  6394.  Subject: FOR/DO...  Clean and Concise explinations?
  6395.  
  6396. BM> Can someone offer c clear idea of the usage for "FOR" / "DO".  I for BM>
  6397. one reason or another am having a problem getting a grasp on this. BM>
  6398. Especially when it is used to run multiple functions on multiple files...
  6399. Maybe a BM> "easy" example, as well as an intermediate on and an advanced one?
  6400.  
  6401.       The problem you mention is going to need a recursion routine
  6402.       but let's start off with a basic For command.
  6403.  
  6404.    FOR/IN/DO LOOP:
  6405.       The For/in/Do loop is so named for the three words needed to
  6406.       make it work. DOS help has a bit to say on the subject and
  6407.       while that is a good place to satrt there is a good deal
  6408.       more to know about FOR. For is made up of three main parts.
  6409.       The call "for", the set "in (.....)", and the command.
  6410.  
  6411.             for %%q  in (this is a for loop)    do echo %%q
  6412.             ^    ^       ^^^^ ^^ ^ ^^^ ^^^^         ^    ^
  6413.               |                 |                   |
  6414.           The call   The set (5 strings)        The command
  6415.  
  6416.       For cycles through the 5 strings in this set one at a time with
  6417.       the help of %%q. %%q is a local variable that takes on the value
  6418.       of each part of the set in turn.
  6419.       In people speak one could translate the first cycle of this
  6420.       For/in/DO loop as "For this do echo this". The next cycle, "For
  6421.       is do echo is".....and so on. the screen result would be......
  6422.  
  6423.             this
  6424.             is
  6425.             a
  6426.             for
  6427.             loop
  6428.  
  6429.       Echoing a list of words probably isn't the most exciting
  6430.       thing you have seen a Batch command do so hows about putting
  6431.       5 file names in the set....
  6432.  
  6433.       For %%q in (this.com is.bat a.txt for.lst loop.pft) do del %%q
  6434.  
  6435.       ...and now we have a tool that deletes 5 files.
  6436.       For nibbels at the edges of real loopdom in that it is controled
  6437.       by the number of strings in the set. The efforts needed to get
  6438.       any great amount of work out of it, however, boarder on the
  6439.       gymnastic.
  6440.       And now to your more advanced question. For can do something
  6441.       to a bunch of things or it can do a bunch of somethings to
  6442.       one thing, but it can't do a bunch of somethings to a bunch
  6443.       of things. Not wothout help that is, and that is where
  6444.       recursion comes in.
  6445.  
  6446.  RECURSIONS:
  6447.       Recursion happens when a Batch file calls itself. Why? You say.
  6448.       Well one reason a .bat might need to recycle itself is to run
  6449.       multiple functions on multiple files. For/in/do loops won't nest,
  6450.       try it and DOS will slap your hands.
  6451.  
  6452.       This....
  6453.  
  6454.          for %%q in (dos mail wrk) do for %%a in (*.bak *.tmp) del %%a
  6455.  
  6456.       will get you this....
  6457.  
  6458.          FOR cannot be nested
  6459.  
  6460.       Oh poo! Well not to fret, Recursion to the rescue......
  6461.  
  6462.          @echo off
  6463.          cls
  6464.             if not %1! == ! goto %1
  6465.             for %%q in (dos mail wrk) do call %0 step2 %%q
  6466.             goto L8r
  6467.          :step2
  6468.             for %%q in (c:\%2\*.bak c:\%2\*.tmp) do del %%q
  6469.          :L8r
  6470.  
  6471.       Not so pretty as the line we tried above, but it has the advantage
  6472.       of not offending Command.com. The first "For" recalls the .bat "%0"
  6473.       with the parameters "step2" and "%%q" which is "dos", "mail"
  6474.       and "wrk" in turn. The second "For" processes, in turn, each
  6475.       directory by deleting each ".bak" and ".tmp" file from the
  6476.       directory named in that current cycle of For#1. "c:\%2\%%q"
  6477.       in the first cycle of For#2 reads as c:\dos\*.bak. In the
  6478.       second cycle it reads "c:\dos\*.tmp"
  6479.       Neat Huh!
  6480.  :L8r
  6481.                  Larry
  6482.             ..... In a pinch a stone ax still works.....
  6483.  
  6484. -!- Maximus 2.02
  6485.  ! Origin: MSDOS MAXIMUS BBS (1:343/101)
  6486.  
  6487. ─ Area: Batch Language Programming                     FI ────────────────────
  6488.   Msg#: 408                                          Date: 26 Apr 96  17:38:12
  6489.   From: Vernon Frazee                                Read: Yes    Replied: No
  6490.     To: Larry Nelson                                 Mark:
  6491.   Subj: 1aday.bat             2/2
  6492. ──────────────────────────────────────────────────────────────────────────────
  6493.    [ ...Continued From Previous Message ]
  6494.  
  6495.     @echo off
  6496.     :1ADAY.BAT runs a specified program once-a-day only ---------------
  6497.      if not (%0)==(1ADAY.BAT) 1ADAY.BAT %1 %2 %3 %4 %5 %6 %7 %8 %9
  6498.      if (%1)==(/?) goto Syntax
  6499.      if not (%1)==() goto Begin
  6500.     :Syntax -----------------------------------------------------------
  6501.      echo      Name: 1ADAY.BAT
  6502.      echo   Purpose: Run a specified command only once a day
  6503.      echo    Syntax: 1ADAY program_name/command [parms...]
  6504.      echo            1ADAY /C   clears all entries
  6505.      echo            1ADAY /?   displays this help
  6506.      echo   Example: 1ADAY DEFRAG C: /F /SN
  6507.      echo  Requires: DOS v6.nn+'s FIND.EXE (in current PATH) and
  6508.      echo            29 bytes free environment space.
  6509.      echo Important: 1ADAY.BAT is self modifying!  It keeps track of
  6510.      echo            when and what was run at the end of itself.
  6511.      echo            Therefore all occurences of "1aday.bat" below
  6512.      echo            must be changed to include the complete path to
  6513.      echo            1ADAY.BAT.  From "1aday.bat" to "c:\bat\1aday.bat"
  6514.      echo            for example.
  6515.      goto End
  6516.     :Begin ------------------------------------------------------------
  6517.      set ~prefix~=:
  6518.      set ~prefix~=%~prefix~%:!
  6519.      for %%x in (c C) do if (%1)==(/%%x) goto ClearData
  6520.     :GetDate ----------------------------------------------------------
  6521.      echo set ~date~=%%3>~tmptmp1.bat
  6522.      dir/-p ~tmptmp1.bat|find "~TMPTMP1 BAT">~tmptmp2.bat
  6523.      for %%x in (call del) do %%x ~tmptmp2.bat
  6524.      del ~tmptmp1.bat
  6525.     :Has current command already been run today? ----------------------
  6526.      find/i "%~prefix~%%~date~%%1%2%3%4%5%6%7%8%9" 1aday.bat>nul
  6527.      if errorlevel 1 goto Nope
  6528.      :Yep ----------------------------
  6529.       echo The command:
  6530.       echo %1 %2 %3 %4 %5 %6 %7 %8 %9
  6531.       echo has already been run today.
  6532.       goto Cleanup
  6533.      :Nope ---------------------------
  6534.       echo %~prefix~%%~date~%%1%2%3%4%5%6%7%8%9>>1aday.bat
  6535.       call %1 %2 %3 %4 %5 %6 %7 %8 %9
  6536.       goto Cleanup
  6537.     :ClearData --------------------------------------------------------
  6538.      type 1aday.bat|find /v "%~prefix~%">1aday.bat
  6539.     :Cleanup ----------------------------------------------------------
  6540.      rem for %%x in (prefix date) do set ~%%x~=
  6541.     :End - Data storage begins below. - Type "1ADAY /?" for info. -----
  6542.     ::!04-23-96dirg:\*.*
  6543.  
  6544.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6545.  
  6546. -!- OLMS 2.53p+ [ERSBN55C]
  6547.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  6548.  
  6549. ─ Area: Batch Language Programming                     FI ────────────────────
  6550.   Msg#: 419                                          Date: 26 Apr 96  12:57:21
  6551.   From: Michael Barnes                               Read: Yes    Replied: No
  6552.     To: Jason Laviska                                Mark:
  6553.   Subj: Command line arguments
  6554. ──────────────────────────────────────────────────────────────────────────────
  6555. Jason Laviska wrote in a message to All:
  6556.  
  6557.  JL>      Is there a way to transmit the entire list of command
  6558.  JL> parameters to a program which will allow me to use more than nine
  6559.  JL> arguments using a batch file in dos 6.x?  Right now all I have
  6560.  JL> is...
  6561.  JL> @Echo off
  6562.  JL> C:\LASRCOMP\LASRCOMP.EXE %1 %2 %3 %4 %5 %6 %7 %8 %9
  6563.  JL> If Errorlevel==0 Echo Files are identical
  6564.  JL> If Errorlevel==255 Echo Files are different
  6565. 'Lo Jason,
  6566.  
  6567.   Yes, use the shift command. (as in the example below)
  6568. but first..  you must list your errorlevel checks in reverse order- such as:
  6569. IF ERRORLEVEL 255 GOTO ERROR255
  6570. IF ERRORLEVEL 254 GOTO ERROR254
  6571. ~~~
  6572. IF ERRORLEVEL 1   GOTO ERROR001
  6573. IF ERRORLEVEL 0   GOTO ERROR000
  6574. -!- Now on to the example ---
  6575. 10PLUS.BAT
  6576. :START
  6577. IF '%2'=='' THEN SET LASTPARAM=TRUE
  6578. ECHO %1>>OUTPUT.TXT
  6579. IF '%LASTPARAM%'=='TRUE' THEN GOTO END
  6580. SHIFT
  6581. GOTO START
  6582. :END
  6583. TYPE OUPUT.TXT |MORE
  6584. -!- So, type:
  6585. 10PLUS ONE 2 THREE 4 FIVE 6 SEVEN 8 NINE 10 ELEVEN 12 THIRTEEN 14 [ENTER]
  6586. and the file OUPUT.TXT will contain all 14 parameters. (the magic is in the
  6587. shift)
  6588.  
  6589. Sincerely,
  6590.  
  6591. Michael
  6592. -!- GEcho 1.20/Pro
  6593.  ! Origin:   On a clear disk, you can seek for ever      (1:271/210)
  6594.  
  6595. ─ Area: Batch Language Programming                     FI ────────────────────
  6596.   Msg#: 439                                          Date: 26 Apr 96  17:38:10
  6597.   From: Vernon Frazee                                Read: Yes    Replied: No
  6598.     To: Ronald Mendoza                               Mark:
  6599.   Subj: Random message display
  6600. ──────────────────────────────────────────────────────────────────────────────
  6601. RM> Now what exactly do you mean by "CHOICE.COM" is required in the PATH
  6602. RM> somewhere...How do you do this?? ANything special? Or do I just add
  6603. RM> "c:\dos\choice.com" to my path in my autoexec.bat???? Please clarify
  6604. RM> this for me! Thanks a lot!
  6605.  
  6606.     At the DOS prompt, you can type:
  6607.  
  6608.       PATH
  6609.  
  6610.     to view the directories in your current PATH.
  6611.  
  6612.     If you keep CHOICE.COM in your C:\DOS directory, (most do), just
  6613.     make sure the directory:
  6614.  
  6615.       C:\DOS
  6616.  
  6617.     is one of the directories in your current PATH.
  6618.  
  6619.     For example, here is the beginning of my current PATH (displayed by
  6620.     typing "PATH"):
  6621.  
  6622.       PATH=g:\key;c:\bat;c:\util;c:\dos;c:\pk;c:\scan
  6623.                                  ~~~~~~
  6624.  
  6625.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6626.  
  6627. -!- OLMS 2.53p+ [ERSBN55C]
  6628.  ! Origin: SOX! Live from Hialeah_FL_USA (305) 821-3317 (1:135/71)
  6629.  
  6630. ─ Area: Batch Language Programming                     FI ────────────────────
  6631.   Msg#: 440                                          Date: 25 Apr 96  10:45:48
  6632.   From: Vernon Frazee                                Read: Yes    Replied: No
  6633.     To: Jesse Jordan                                 Mark:
  6634.   Subj: Random numerical stuff
  6635. ──────────────────────────────────────────────────────────────────────────────
  6636.     Hello Jesse,
  6637.  
  6638.     If I've already answered the following, please ignore this dupe.
  6639.     BBN, "Buggy BossNode" ;(
  6640.  
  6641. JJ> Great so far! I have no idea how you got the date in this message,
  6642. JJ> but could you get the little split-seconds? I could use that
  6643. JJ> variable for the random number. And since it needs to be under 100,
  6644. JJ> 60 works great... That way, the role-playing character can start
  6645. JJ> low, and work stats up. See, in using seconds, I usually get stats
  6646. JJ> like this:
  6647. JJ>   15
  6648. JJ>   22  <--doesn't take this much time, but the example stands of it
  6649. JJ>   35  <--passing from lesser to greater.
  6650. JJ>   46
  6651. JJ>   56
  6652. JJ> It creates them in numerical order as the calls to the
  6653. JJ> variable-catching bat are made.
  6654. JJ> To speed things up, how about a bat the only catches the
  6655. JJ> splitsecond? <I couldn't do it if my life depended on it.>
  6656.  
  6657.     @echo off
  6658.     :RND.BAT - Copies the two digit hundredths-of-a-second
  6659.     :          from the current system time into an
  6660.     :          environment variable named RND.  Requires
  6661.     :          DOS's CHOICE.COM (somewhere in the PATH) and
  6662.     :          17 bytes free environment space.
  6663.     :Begin -------------------------------------------------
  6664.      ver|time>~rndtmp~.bat
  6665.      echo set rnd=%%3>current.bat
  6666.      call ~rndtmp~.bat
  6667.      del current.bat
  6668.      echo;;|choice /c:;%rnd%; "current ">~rndtmp~.bat
  6669.      for %%x in (1 2 3 4 5 6 7 8) do echo shift>>current.bat
  6670.      echo if not (%%1)==(.) shift>>current.bat
  6671.      echo if (%%1)==(.) shift>>current.bat
  6672. -->  echo set rnd=%%1%%2>>current.bat
  6673.      for %%x in (call del) do %%x ~rndtmp~.bat
  6674.      del current.bat
  6675.      echo RND=%rnd%
  6676.     :End --------------------------------------------- -vjf-
  6677.  
  6678.     Note: You can simply change the "%%1%%2" in the line marked with
  6679.           "-->" to "%%2%%1" if you'd rather have the second digit of the
  6680.           100ths of a second first.  For example, as it is, if the
  6681.           current time was "10:49:15.24a" the RND evar would be "24".
  6682.           If you reverse the %%1%%2 to %%2%%1, it would be "42".
  6683.  
  6684. JJ> Thanks for your help!
  6685.  
  6686.     Sure, no problem.
  6687.  
  6688.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6689. -!- Terminate 4.00
  6690.  ! Origin: Terminate IS the final terminal! (1:135/71.17)
  6691.  
  6692. ─ Area: Batch Language Programming                     FI ────────────────────
  6693.   Msg#: 418                                          Date: 26 Apr 96  08:36:01
  6694.   From: Greg Smith                                   Read: Yes    Replied: No
  6695.     To: Jerry Dugal                                  Mark:
  6696.   Subj: count lines in txt file
  6697. ──────────────────────────────────────────────────────────────────────────────
  6698. For reasons that are still not clear, Jerry Dugal said...
  6699.  
  6700.  JD> I need to count the # of lines in a txt file, any one have an idea on
  6701.  JD> the  best way to go about doing this?
  6702.  
  6703. Here we have one of those cases where we use a DOS command for something
  6704. completely different than what it was intended for...
  6705.  
  6706. @echo off
  6707. :: LCOUNT.BAT  - puts line count of specified file into LINES env variable
  6708. :: ---------------------------
  6709. :: Usage: LCOUNT filename.ext
  6710. :: ---------------------------
  6711. if (%1) == () EXIT
  6712. echo IF (%%1%) == () GOTO RERUN > --------.BAT
  6713. echo SET LINES = %%2% >> --------.BAT
  6714. echo  GOTO EXIT >> --------.BAT
  6715. echo :RERUN >> --------.BAT
  6716. find /V /C "-[gobbley&gook]-" %1 >> --------.BAT
  6717. :: you can use any "string" that you KNOW is NOT in the TEXT file to search.
  6718. echo :EXIT >> --------.BAT
  6719. call --------.BAT
  6720. del --------.BAT
  6721.  
  6722.  
  6723. -!- JMail-G 2.80a
  6724.  ! Origin: ACCENT! - Chandler, AZ - (602) 814-7894 (1:114/402)
  6725.  
  6726. ─ Area: Batch Language Programming                     FI ────────────────────
  6727.   Msg#: 429                                          Date: 26 Apr 96  12:03:11
  6728.   From: Vernon Frazee                                Read: Yes    Replied: No
  6729.     To: Jerry Dugal                                  Mark:
  6730.   Subj: count lines in txt file
  6731. ──────────────────────────────────────────────────────────────────────────────
  6732. JD> I need to count the # of lines in a txt file, any one have an idea
  6733. JD> on the best way to go about doing this?
  6734.  
  6735.     If you mean count all the lines in a text file that:
  6736.  
  6737.       1) actually contain text (in other words, don't count the
  6738.          blank lines)
  6739.  
  6740.     and
  6741.  
  6742.       2) all the lines of text have at least one space somewhere in
  6743.          the line
  6744.  
  6745.     then the following DOS command will work:
  6746.  
  6747.       TYPE name_of_file|FIND /C " "
  6748.  
  6749.  
  6750.     If you want to count _ALL_ of the lines in a text file AND you know
  6751.     that NONE of the lines would contain some strange sequence of
  6752.     characters like say:
  6753.  
  6754.       ~!1@2#3$4~
  6755.  
  6756.     the following DOS command will work:
  6757.  
  6758.       TYPE name_of_file|FIND /C /V  "~!1@2#3$4~"
  6759.  
  6760.  
  6761.     And if you wanted to do something like count only the lines that had
  6762.     the string "the" in them, either upper- or lower-case, the command
  6763.     would be:
  6764.  
  6765.       TYPE name_of_file|FIND /C /I "the"
  6766.  
  6767.  
  6768.     How many fonts are being loaded in Windows 3.1n's WIN.INI?
  6769.  
  6770.       TYPE C:\WINDOWS\WIN.INI|FIND /C ".FO"
  6771.  
  6772.  
  6773.     'Kewl' eh? <g>
  6774.  
  6775.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6776. -!- Terminate 4.00
  6777.  ! Origin: Get real, get better, get faster, get Terminate! (1:135/71.17)
  6778.  
  6779. ─ Area: Batch Language Programming                     FI ────────────────────
  6780.   Msg#: 448                                          Date: 28 Apr 96  11:58:00
  6781.   From: Benjamin L Mcgee                             Read: Yes    Replied: No
  6782.     To: Vernon Frazee                                Mark:
  6783.   Subj: ERRORLEVEL
  6784. ──────────────────────────────────────────────────────────────────────────────
  6785.  BLM> if errorlevel 255 echo 255
  6786.  BLM> if etc. etc. etc. ...
  6787.  BLM> if not errorlevel 1 echo 0
  6788.  
  6789.  VF>     How about something just a wee bit shorter (and faster)
  6790.  VF> than the above 257-line (minimum) monster:
  6791.  
  6792. [inspiring code deleted....]
  6793.  
  6794. Your code inspired me to pen the following, which seemes to work
  6795. fine for me.  Do you see any potential (or current) problems with
  6796. it.  Thanx blm
  6797.  
  6798. @echo off
  6799. :: EL.BAT blm 1996
  6800. :: Set "ERROR" environment variable to last ERRORLEVEL
  6801. :: and echo ERRORLEVEL
  6802.  
  6803. set error=
  6804. set errh=0
  6805. set errm=0
  6806. set errl=0
  6807.  
  6808. for %%h in (1 2) do if errorlevel %%h00 set errh=%%h
  6809. for %%m in (1 2 3 4 5 6 7 8 9) do if errorlevel %errh%%%m0 set errm=%%m
  6810. for %%l in (1 2 3 4 5 6 7 8 9) do if errorlevel %errh%%errm%%%l set errl=%%l
  6811.  
  6812. for %%e in (%errh% %errm% %errl%) do if not "%%e"=="0" set error=%error%%%e
  6813. if "%error%"=="" set error=0
  6814.  
  6815. set errh=
  6816. set errm=
  6817. set errl=
  6818.  
  6819. echo Errorlevel %error%
  6820. Benjamin L McGee on 1:15/7
  6821.  
  6822. *FACT: There are more horse's asses than there are horses
  6823.  
  6824. -!- FLAME v1.1
  6825.  ! Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
  6826.  
  6827. ─ Area: Batch Language Programming                     FI ────────────────────
  6828.   Msg#: 445                                          Date: 29 Apr 96  18:42:00
  6829.   From: Jason Laviska                                Read: Yes    Replied: No
  6830.     To: All                                          Mark:
  6831.   Subj: Command line arguments
  6832. ──────────────────────────────────────────────────────────────────────────────
  6833.      After all useful messages concerning the SHIFT function, I would like to
  6834. say thanks to those who have responded with tips and hints.  I have pretty much
  6835. combined all the messages regarding this topic and ended up using this batch
  6836. file below.  This message is mainly for those people who helped me, but
  6837. couldn't come up with the full solution.  If you see any problems with it, let
  6838. me know.
  6839.  
  6840.   @Echo Off
  6841.   If Exist LCDATA.TMP Del LCDATA.TMP >Nul
  6842.   If "%1"=="" Goto ERROR
  6843.   :START
  6844.   If "%1"=="" Goto RUNLC
  6845.   Echo %1 >>LCDATA.TMP
  6846.   SHIFT
  6847.   GOTO START
  6848.   :ERROR
  6849.   Echo No Command Line Parameters!
  6850.   C:\LASRCOMP\LASRCOMP.EXE /?
  6851.   Goto END
  6852.   :RUNLC
  6853.   C:\LASRCOMP\LASRCOMP.EXE @LCDATA.TMP
  6854.   Del LCDATA.TMP >Nul
  6855.   :END
  6856.  
  6857.      First it will check to see if the temporary exists, and if so, it will
  6858. delete it.  Next, it will create a file called LCDATA.TMP and store all the
  6859. command line variables by looping the command arguments using the SHIFT
  6860. command.  If there are no arguments were given to the batch file, it will
  6861. display the help file for LASRCOMP.EXE using the /? switch.  Afterwards, it
  6862. will then run the program using the temporary file as its command parameter.
  6863. (LaserCompare WILL read the file contents and use it as its command line if you
  6864. put a "@" sign in front of it.)   In the end, the batch file will discard the
  6865. temporary file.
  6866. - Jason Laviska
  6867.  
  6868.  ! Origin: _C_E_N_T_R_A_L__S_T_A_T_I_O_N_ * OS/2 * Melbourne,FL * (1:374/31)
  6869.  
  6870. ─ Area: Batch Language Programming                     FI ────────────────────
  6871.   Msg#: 434                                          Date: 29 Apr 96  05:31:26
  6872.   From: Vernon Frazee                                Read: Yes    Replied: No
  6873.     To: Gary Smith                                   Mark:
  6874.   Subj: ERRORLEVEL
  6875. ──────────────────────────────────────────────────────────────────────────────
  6876. VF> How about something just a wee bit shorter (and faster) than the
  6877. VF> above 257-line (minimum) monster:
  6878.  
  6879. GS> Your routine is prretty cool, but this one is shorter and uses no
  6880. GS> more than seven bytes of environment space.
  6881.  
  6882. GS> @echo off
  6883. GS> ::
  6884. GS> :: Set environment variable EL to the current error level,
  6885. GS> :: expressed as a 1-3 digit number (leading zeros suppressed).
  6886. GS> ::
  6887. GS> for %%h in (0 1 2) do if errorlevel %%h00 set EL=%%h
  6888. GS> if %EL% == 0 set EL=
  6889. GS> if errorlevel 200 for %%t in (0 1 2 3 4 5) do if errorlevel
  6890. GS>    2%%t0 set EL=2%%t
  6891. GS> if not errorlevel 200 for %%t in (0 1 2 3 4 5 6 7 8 9) do if
  6892. GS>    errorlevel %EL%%%t0 set EL=%EL%%%t
  6893. GS> if %EL% == 0 set EL=
  6894. GS> if errorlevel 250 for %%u in (0 1 2 3 4 5) do if errorlevel
  6895. GS>    25%%u set EL=%EL%%%u
  6896. GS> if not errorlevel 250 for %%u in (0 1 2 3 4 5 6 7 8 9) do if
  6897. GS>    errorlevel %EL%%%u set EL=%EL%%%u
  6898. GS> echo Error level = %EL%
  6899. GS>
  6900. GS> Note: indented lines are continuations for the preceding lines, so
  6901. GS> there are actually only seven "working" lines in the file. If you
  6902. GS> want a result that's always three digits, instead of dropping
  6903. GS> leading zeros, remove the two lines which begin "if %EL% == 0".
  6904.  
  6905.     Pretty cool!  Beat my filesize by a single byte.  Yours was 444
  6906.     compared to mine at 445.  Went to work on yours though and durn
  6907.     near whittled 100 bytes, down to 348:
  6908.  
  6909.       @echo off
  6910.       set A=0 1 2 3 4 5
  6911.       set B=%A% 6 7 8 9
  6912.       set C=errorlevel
  6913.       set D=) do if %C%
  6914.       set F=for %%x in (
  6915.       set G= set E
  6916.       %F%0 1 2%D% %%x00%G%=%%x
  6917.       if %C% 200 %F%%A%%D% 2%%x0%G%=2%%x
  6918.       if not %C% 200 %F%%B%%D% %E%%%x0%G%=%E%%%x
  6919.       if %C% 250 %F%%A%%D% 25%%x%G%=%E%%%x
  6920.       if not %C% 250 %F%%B%%D% %E%%%x%G%=%E%%%x
  6921.       echo %E%
  6922.       %F%A B C D E F G) do set %%x=
  6923.  
  6924.     Applied the same technique to mine and it's now at 329 bytes:
  6925.  
  6926.       @echo off
  6927.       set F=for %%x in (
  6928.       set E=errorlevel|%F%A B) do set %%x=0 1 2 3 4 5
  6929.       if not %E% 250 set A=%A% 6 7 8 9
  6930.       if not %E% 200 set B=%A%
  6931.       %F%1 2) do if %E% %%x00 set C=%%x
  6932.       %F%%B%) do if %E% %C%%%x0 set D=%%x
  6933.       if (%C%%D%)==(0) set D=
  6934.       set C=%C%%D%
  6935.       %F%%A%) do if %E% %C%%%x set D=%C%%%x
  6936.       echo %D%
  6937.       %F%A B C D E F) do set %%x=
  6938.  
  6939.     (Yours displays errorlevels with leading zeros, mine does not).
  6940.  
  6941.     Of course as you can tell, with these particular variations I wasn't
  6942.     worried about environment space nor the number of lines.  All I was
  6943.     really concerned with is simply the fewest number of bytes required
  6944.     to get the job done, (and, using nothing more than COMMAND.COM).
  6945.  
  6946.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  6947. -!- Terminate 4.00
  6948.  ! Origin: Terminate is available from a dealer near you! (1:135/71.17)
  6949.  
  6950. ─ Area: Batch Language Programming                     FI ────────────────────
  6951.   Msg#: 443                                          Date: 07 May 96  21:12:10
  6952.   From: Andy Guess                                   Read: Yes    Replied: No
  6953.     To: Larry Kwiatkowski                            Mark:
  6954.   Subj: FOR/DO...  Clean and Conc
  6955. ──────────────────────────────────────────────────────────────────────────────
  6956. LK->Hokay - I understand the for-in-do function. Could anyone hazard a guess wh
  6957. LK->it will not work, for example, in autoexec with multiple "set" commands? Th
  6958. LK->has always puzzled me.
  6959.  
  6960. For multiple SET's on one line, use:
  6961. SET variable1=value1|SET variable2=value2|SET variable3=value3
  6962. You can do that as long as the line is less than 128 characters.
  6963. Hope I helped!
  6964. Cya,
  6965. -AG
  6966.  
  6967.  
  6968.  * SLMR 2.1a * Is this yours? Your dog left it on my lawn ...
  6969.  
  6970. -!-
  6971.  ! Origin: * My Place BBS * Bowie, Md USA * V.34 * (301)805-1602 * (1:109/570)
  6972.  
  6973. ─ Area: Batch Language Programming                     FI ────────────────────
  6974.   Msg#: 450                                          Date: 06 May 96  14:58:47
  6975.   From: Vernon Frazee                                Read: Yes    Replied: No
  6976.     To: Joe Kron                                     Mark:
  6977.   Subj: Text Input HELP!
  6978. ──────────────────────────────────────────────────────────────────────────────
  6979. JK> See PC Mag. 5-25-'93 pg. 299. This is one of many third party string
  6980. JK> input utilities. ANSWER is another in The Best of IBM PC Shareware
  6981. JK> that puts the string in an EVAR. There is also PC Mag's STRINGS
  6982. JK> which does this and more. But I must say the best answer is still
  6983. JK> 4DOS.
  6984.  
  6985.     Why go searching for a third and/or spending money when DOS provides
  6986.     the capability?
  6987.  
  6988.       @echo off
  6989.       :INPUT.BAT puts what is typed next in environment variable INPUT
  6990.        set input=
  6991.        echo INPUT.BAT
  6992.        echo Type in something and press [Enter]
  6993.        fc con nul /lb1 /n|date|find "    1:  ">temptemp.bat
  6994.        echo :Loop>>enter.bat
  6995.        echo if not (%%input%%)==() set input=%%input%% %%5>>enter.bat
  6996.        echo if (%%input%%)==() set input=%%5>>enter.bat
  6997.        echo shift>>enter.bat
  6998.        echo if not (%%5)==() goto Loop>>enter.bat
  6999.        for %%x in (call del) do %%x temptemp.bat
  7000.        del enter.bat
  7001.        echo The string you just entered:
  7002.        echo %input%
  7003.        echo has been stored in an environment variable named INPUT
  7004.       :End
  7005.  
  7006.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7007. -!- Terminate 4.00
  7008.  ! Origin: Terminate point system (1:135/71.17)
  7009.  
  7010. ─ Area: Batch Language Programming                     FI ────────────────────
  7011.   Msg#: 430                                          Date: 07 May 96  19:02:00
  7012.   From: Jeff Brielmaier                              Read: Yes    Replied: No
  7013.     To: Osgar Schaedtler                             Mark:
  7014.   Subj: DETECT IF WINDOWS IS RUNN
  7015. ──────────────────────────────────────────────────────────────────────────────
  7016. OS>Is there a way to detect, in a batch file, if Windows is running?
  7017.  
  7018.    set|find "windir= >nul
  7019.    if errorlevel 1 goto NotRunning
  7020.    ....Windows is running....
  7021.  
  7022.  * KingQWK 1.05 # [PK] * DESQview vs. Windows is a no-Win situation.
  7023.  
  7024. -!- FLAME v1.1
  7025.  ! Origin: HAL-PC - (713)963-4100 (1:106/4100)
  7026.  
  7027. ─ Area: Batch Language Programming                     FI ────────────────────
  7028.   Msg#: 431                                          Date: 05 May 96  10:08:00
  7029.   From: Horst Schaeffer                              Read: Yes    Replied: No
  7030.     To: Vernon Frazee                                Mark:
  7031.   Subj: ERRORLEVEL
  7032. ──────────────────────────────────────────────────────────────────────────────
  7033. -=> quoting Vernon Frazee to Gary Smith (29 Apr 96) <=-
  7034.  
  7035. VF>     [....]
  7036. VF>     Applied the same technique to mine and it's now at 329 bytes:
  7037.  
  7038. VF>       @echo off
  7039. VF>       set F=for %%x in (
  7040. VF>       set E=errorlevel|%F%A B) do set %%x=0 1 2 3 4 5
  7041. VF>       [....]
  7042.  
  7043. Wow! But what shall I do with the rest of the 32Kb cluster?
  7044.  
  7045. Wouldn't it be more useful to have a routine that's simple and
  7046. easy to understand? For example:
  7047.  
  7048.  @echo off
  7049.  set !=
  7050.  for %%h in (0 1 2) do if errorlevel %%h00 set EL=%%h
  7051.  if not errorlevel 200 set !=6 7 8 9
  7052.  for %%t in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%t0 set EL=%EL%%%t
  7053.  if not errorlevel 250 set !=6 7 8 9
  7054.  for %%u in (0 1 2 3 4 5 %!%) do if errorlevel %EL%%%u set EL=%EL%%%u
  7055.  echo %EL%
  7056.  set !=
  7057.  set EL=
  7058.  
  7059. No fluff to save space ;-) ... and only 316 bytes.
  7060.  
  7061. VF>     ..... displays errorlevels with leading zeros, mine does not
  7062.  
  7063. Would require minor modifications (+24 bytes) - but I prefer to
  7064. leave it as simple as it is.
  7065.  
  7066. Horst.
  7067. ... Q4FM 2.10a ... horst@confusion.rmc.de
  7068.  
  7069. -!- FM 2.02 / ScanToss
  7070.  ! Origin: Don't follow leaders! (2:2480/13.75)
  7071.  
  7072. ─ Area: Batch Language Programming                     FI ────────────────────
  7073.   Msg#: 443                                          Date: 12 May 96  23:40:02
  7074.   From: Raphael Neve                                 Read: Yes    Replied: No
  7075.     To: John Medland                                 Mark:
  7076.   Subj: deleteing the undeletable dir
  7077. ──────────────────────────────────────────────────────────────────────────────
  7078. Following up a message from Malcolm Campbell to John Medland:
  7079.  
  7080.  JM=> I had this problem a year or so ago and it's come back to haunt
  7081.  JM=> me. Some one had given me a solution but I've lost the message
  7082.  JM=> now. The problem:
  7083.  JM=> A directory has been renamed using an illegal name.
  7084.  JM=> Dos can't delete or rename the dir. No programs can delete it
  7085.  JM=> either. It was named c:\max\cbv, but the name has been changed to
  7086.  JM=> c:\max\cbv    á. Anyone?
  7087.  
  7088. if you really want to get radical, you can always use a disk sector editor to
  7089. delete the file "by hand" :) seriously... all you have to do is:
  7090. a) load up your favourite sector editor
  7091. b) search for a distinguishing string (the directory name in question (CBV) or
  7092. any other file in the same directory... make sure you do all capitals
  7093. c) make sure you've got the right file / directory name
  7094. d) check again
  7095. e) kneel down in front of the computer and call upon the computer gods to
  7096. protect you
  7097. f) cross fingers and touch wood
  7098. g) replace the first character of the file or directory name by E5
  7099. h) make sure you don't change anthing else
  7100. h) save and quit
  7101.  
  7102. check you did it right by doing a dir. if you still see it and you're sure you
  7103. saved, then you've done something wrong and the results are unpredictable. if
  7104. you don't then you're well on your way to becoming a die-hard-disk-sector-
  7105. editor guru. then run scandisk to get rid of the lost clusters (ie all the
  7106. stuff that didn't get unlinked when you got rid of the directory or file
  7107. "manually")
  7108.  
  7109. note: kids, don't do this at home!!!
  7110.  
  7111. raph.
  7112.  
  7113. p.s. this is accurate: in a nutshell, dos recognises files that are deleted
  7114. from those that aren't by checking if the first character of a filename /
  7115. directory name is 'e5'. when you delete a file, all that happens is this
  7116. character gets written in the fat on top of the first character of the filename
  7117. (well, actually the associated clusters are freed too but that's nothing to do
  7118. with the fat). anyway... by writing this character in there yourself, you
  7119. effectively delete the file.
  7120.  
  7121. ... Buy Stacker?  Why not just delete Windows?
  7122. -!- FMail 0.96Γ
  7123.  ! Origin:  Canada Dry BBS - France * 3 lines on 47.29.33.85  (2:321/1)
  7124.  
  7125.  
  7126. ─ Area: Batch Language Programming                     FI ────────────────────
  7127.   Msg#: 435                                          Date: 14 May 96  20:15:46
  7128.   From: Vernon Frazee                                Read: Yes    Replied: No
  7129.     To: Larry Nelson                                 Mark:
  7130.   Subj: errorlevel
  7131. ──────────────────────────────────────────────────────────────────────────────
  7132. LN> Here's my 2 bits worth.
  7133. LN>
  7134. LN> ::ERR.BAT/DOS6.20
  7135. LN> :: Tested through errorlevel 26
  7136. LN> @echo off
  7137. LN> cls
  7138. LN> for %%h in (0 1 2) do if errorlevel %%h00 set L=%%h
  7139. LN> for %%t in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %L%%%t0 set L=%L%%%t
  7140. LN> for %%u in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %L%%%u set L=%L%%%u
  7141. LN> echo errorlevel=%L%
  7142. LN> set L=
  7143. LN> :L8r
  7144. LN>
  7145. LN> Less code, no temp files, 1 envar, and 280 bytes.
  7146. LN> :L8r
  7147.  
  7148.     A measly 7 more bytes and you get 'em all:
  7149.  
  7150.       @echo off
  7151.       set e=Errorlevel|set !=|set p=for %%t in (0 1 2
  7152.       %p%) do if %e% %%t00 set L=%%t
  7153.       if not %e% 200 set !=6 7 8 9
  7154.       %p%3 4 5 %!%) do if %e% %L%%%t0 set L=%L%%%t
  7155.       if not %e% 250 set !=6 7 8 9
  7156.       %p%3 4 5 %!%) do if %e% %L%%%t set L=%L%%%t
  7157.       set !=|set L=|set e=|set p=|echo %e%=%L%
  7158.  
  7159.     <g>
  7160. -!- Terminate 4.00
  7161.  ! Origin: Terminate point system (1:135/71.17)
  7162.  
  7163. ─ Area: Batch Language Programming                     FI ────────────────────
  7164.   Msg#: 441             Rec'd                        Date: 22 May 96  18:04:53
  7165.   From: Vernon Frazee                                Read: Yes    Replied: No
  7166.     To: Bat Lang                                     Mark:
  7167.   Subj: FOR/DO...  Clean and Conc
  7168. ──────────────────────────────────────────────────────────────────────────────
  7169. VF>   for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  7170. VF> If you'll watch DOS process this line, you can see it doing
  7171. VF> exactly the same thing as the above four individual lines
  7172. VF>   SET TEMP=C:\TEMP
  7173. VF>   SET TMP=C:\TEMP
  7174. VF>   SET LIST=C:\TEMP
  7175. VF>   SET AHDTMP=C:\TEMP
  7176.  
  7177. BL> Which is faster in execution, your first quoted line, or?:
  7178. BL> SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  7179.  
  7180.     To slow them down enough to be able to even time them, I did 10
  7181.     iterations of each.  IOW,
  7182.  
  7183.     @echo off
  7184.     :FORINDO.BAT
  7185.     for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  7186.     for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  7187.     for %%x in (TEMP TMP LIST AHDTMP) do SET %%x=C:\TEMP
  7188.     ... 10 of these for-in-do's ...
  7189.  
  7190.     @echo off
  7191.     :SET-EACH.BAT
  7192.     SET TEMP=C:\TEMP
  7193.     SET TMP=C:\TEMP
  7194.     SET LIST=C:\TEMP
  7195.     SET AHDTMP=C:\TEMP
  7196.     set temp=c:\temp
  7197.     set tmp=c:\temp
  7198.     set list=c:\temp
  7199.     set ahdtmp=c:\temp
  7200.     SET TEMP=C:\TEMP
  7201.     SET TMP=C:\TEMP
  7202.     SET LIST=C:\TEMP
  7203.     SET AHDTMP=C:\TEMP
  7204.     ... 10 sets of these groups of four ...
  7205.  
  7206.     @echo off
  7207.     :ALLON1.BAT
  7208.     SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  7209.     SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  7210.     SET TEMP=C:\TEMP|SET TMP=C:\TEMP|SET LIST=C:\TEMP|SET AHDTMP=C:\TEMP
  7211.     ... 10 of these lines ...
  7212.  
  7213.  
  7214.     I then ran each 10 times and averaged the elapsed times.  Results:
  7215.  
  7216.       BATch file    Elapsed Time
  7217.       ------------  -------------
  7218.       FORINDO.BAT    1:59 seconds
  7219.       SET-EACH.BAT   1:37 seconds
  7220.       ALLON1.BAT    10:99 seconds
  7221.  
  7222.     Yep, I couldn't believe it either. <G>
  7223.  
  7224.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7225. -!- Terminate 4.00
  7226.  ! Origin: Terminate point system (1:135/71.17)
  7227.  
  7228. ─ Area: Batch Language Programming                     FI ────────────────────
  7229.   Msg#: 419                                          Date: 23 May 96  16:49:56
  7230.   From: Vernon Frazee                                Read: Yes    Replied: No
  7231.     To: Jesse Block                                  Mark:
  7232.   Subj: Bat Needed!
  7233. ──────────────────────────────────────────────────────────────────────────────
  7234. JB> The other day, we were tring to make a Batch file that would comb
  7235. JB> through an ASCII file and pullout all the web address, then, put
  7236. JB> them into another ASCII file called NET.TXT.    We found this could
  7237. JB> do it from MS_DOS 6.22:
  7238. JB>
  7239. JB>   for %f in (*.txt) do find "http:" %f > net.txt
  7240. JB>
  7241. JB> but for some reason, we couldn't use this in a batch file.  It kept
  7242. JB> coming back "syntax error" but it worked fine from a dos prompt. So,
  7243. JB> here's my problem:
  7244. JB>
  7245. JB> 1. Can this be done as a batch file in a different way?
  7246. JB>
  7247. JB> 2. What did I do wrong that _this_ wouldn't work?
  7248.  
  7249.     DOS strips one of the percent signs when for-in-do is being used in
  7250.     a BATch file.  Therefore, if you'll change both occurances of "%f"
  7251.     to "%%f" it should work just fine.
  7252.  
  7253.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7254. -!- Terminate 4.00/Pro
  7255.  ! Origin: Terminate point system (1:135/71.17)
  7256.  
  7257. ─ Area: Batch Language Programming                     FI ────────────────────
  7258.   Msg#: 407                                          Date: 23 May 96  10:24:40
  7259.   From: Richard Epling                               Read: Yes    Replied: No
  7260.     To: Alan Milewczyk                               Mark:
  7261.   Subj: Capturing date in a batch
  7262. ──────────────────────────────────────────────────────────────────────────────
  7263.     From: Alan Milewczyk                       Time: 05-19-96 13:30:30
  7264. > I want to be able to capture today's date into a batch file to enable
  7265. > me to copy files in a specific directory with the attribute flag set.
  7266. > How do I capture the date and pass it over to the copy file routine.
  7267.  
  7268. I don't understand how you would use the date to copy the files but I'm
  7269. assuming you do. One way you could do this would be to get the output of a
  7270. DATE command into a temporary batch file which you could then use to run
  7271. another batch file to do what you want to do. For example;
  7272.  
  7273. @ECHO OFF
  7274. ECHO.|DATE|FIND /I "CURRENT">TEMP.BAT
  7275.  
  7276. That will put the line "Current date is Thu 05-23-1996" into TEMP.BAT.
  7277. You can then either have a batch file name CURRENT.BAT to do the work, and
  7278. CALL TEMP.BAT or ECHO the commands you want to CURRENT.BAT. For example to
  7279. set an environment variable with the current date you could continue the
  7280. above example with these lines;
  7281.  
  7282. ECHO SET D8=%%4>CURRENT.BAT
  7283. CALL TEMP.BAT
  7284.  
  7285. That will give you an environment variable you might be able to use in your
  7286. other batch command. Note the double percent sign is required here. The
  7287. contents of CURRENT.BAT would be "SET D8=%4." CALLing TEMP.BAT would cause it
  7288. to run CURRENT.BAT which would set the variable for you. Hope this is what you
  7289. need.
  7290.  
  7291. Richard
  7292. -!- FreeMail 1.09
  7293.  ! Origin: Electric Eye-28.8 Sacramento,CA(916)441-5465    (1:203/65)
  7294.  
  7295.  
  7296. ─ Area: Batch Language Programming                     FI ────────────────────
  7297.   Msg#: 449                                          Date: 27 May 96  00:00:00
  7298.   From: Mike Zeleski                                 Read: Yes    Replied: No
  7299.     To: Robin Chapple                                Mark:
  7300.   Subj: Where To Start?
  7301. ──────────────────────────────────────────────────────────────────────────────
  7302. RC>Greetings To All!
  7303.  
  7304. RC>         I'm wanting to learn more about batch file programming.
  7305. RC>         Where does a 'know nothing' start?
  7306.  
  7307. With the basics...  :-}
  7308.  
  7309. RC>Is there a file I can download?
  7310.  
  7311. Several, notably you should look for MUF17, and any one of several Batch
  7312. programming tutorial that exist on the Nets...
  7313.  
  7314. RC>Is there a good book that I can buy?
  7315.  
  7316. Several, however you should already have a good one already...
  7317.  
  7318. Your Dos Manual, and the Dos Help program.  While they are not
  7319. particularly batch specific, they will help a lot.
  7320.  
  7321. The other features of BFP are not all that bad to master.
  7322. Excluding ordinary Dos commands, BFP just adds a few instructions,
  7323. labels, and variables to the mix...
  7324.  
  7325. Lets see...
  7326. %1-%9 are handled much like Dos command line variables,
  7327. There is a IF (?) command, Labels to go to, and several other bits...
  7328.  
  7329. See below for a few examples.  This little bit is notoriously short on
  7330. how to's beyond the vary basic minimums, but frankly let's discuss them
  7331. later when you have specific questions to ask...
  7332.  
  7333. [Start Mike's BFP MiniFaq.]
  7334.  
  7335. Batch file program is based on the simple conjecture that it is easy to
  7336. create a user readable text file program/utility that simply stacks Dos
  7337. commands together with just a few special BFP commands to do actions
  7338. like move a file or create a directory and move to it without having to
  7339. create a program to do so from scratch...
  7340.  
  7341. This can be a simple way to automate anything that you do more than
  7342. once. With a few external Batch programming aids, the use of command
  7343. line variables, internal variables, Qbasic calls, stacked commands,
  7344. errorlevel jumps, Labels, and Goto's these "little" programs can get
  7345. quite sophisticated and complicated in a hurry.
  7346.  
  7347. However BFP is best when kept to the basics for most mundane everyday
  7348. uses, as in good engineering KISS is the word.  As a tip I often use a
  7349. little batch file that dumps doskey's remembered commands into a little
  7350. batch file and immediately edit it like so.
  7351.  
  7352. Qckbat.bat (Use D:\path\xxxxxxxx.bat CM parameter)
  7353.  
  7354. DOSKEY /HISTORY > %1
  7355. EDIT %1
  7356.  
  7357. This little example dumps past instructions into a batch file and
  7358. immediately sends you into edit to make some small changes to that
  7359. batch file. (You must have doskey loaded to make this work.)
  7360.  
  7361. I also used a Batchfile program to present a nice menu with ansi.sys
  7362. commands and a external utility to run my most frequently used programs
  7363. from. I did this to even run some Windows programs or plain Windows by
  7364. itself. Did you know that you can start Windows and run a Windows program
  7365. immediately from the commandline...
  7366.  
  7367. In fact here are a few clips from that menu, (If you want the entire
  7368. thing including the utility I used to use, Netmail me.) One of the
  7369. below clips includes the most efficient defrag command line I know of.
  7370. It's only a few percent better than a simple consolidation, but what the
  7371. hay, you might as well do it right...
  7372.  
  7373. [quote mode on.]
  7374.  
  7375. :run_defr
  7376. C:\d\defrag C: /F /S:E
  7377. goto restart2
  7378.  
  7379. :run_qmdm
  7380. win c:\qmpw\qmwin qmwin.phn 1
  7381. rem This little string starts Windows, my old Q-modem terminal program,
  7382. rem calls my main bbs mail #, and it's attached script.  Mail run.
  7383. rem Automation! 3 command line parameters for two different programs.
  7384. goto restart
  7385.  
  7386. :winstart
  7387. win
  7388. rem Run Windows.
  7389. goto restart
  7390.  
  7391. :wp_60
  7392. win C:\wp60\wp
  7393. rem Same as above with Word Perfect 6 for windows.
  7394. goto restart
  7395.  
  7396. :win_word
  7397. win C:\winword\winword.exe
  7398. Rem Yes, I do Microsoft apps. But you should hear the wave file attached
  7399. rem to this program's start up it. Ahooga.wav
  7400. goto restart
  7401.  
  7402. :Gramtx_5
  7403. Win: c:\gmkw\gmkw.exe
  7404. rem sometimes we use bad english, don't we...
  7405. goto restart
  7406.  
  7407. [quote mode off.]
  7408.  
  7409. Some other useful examples...
  7410.  
  7411. MDCD.BAT (Use xxxxxxxxxxx directory name CM param.)
  7412.  
  7413. MD %1
  7414. CD %1
  7415.  
  7416. This little BFP creates the directory and moves you directly into the
  7417. directory that it just created.  Use just like you would use both MD &
  7418. CD, but it combines them into just one command...
  7419.  
  7420. Header.bat (Use D:\path\xxxxxxxx.txt CM parameter.)
  7421.  
  7422. @Echo (One line of text here) > JUNK.txt
  7423. copy JUNK.TXT + %1 %1
  7424. del junk.txt
  7425.  
  7426. This little installs adds one line of prespeficified text into the
  7427. beginning of every file indicated as the commandline parameter.
  7428.  
  7429. If you want to add more than one line then you do it this way...
  7430.  
  7431. Header.bat (Use D:\path\xxxxxxxx.txt CM parameter.)
  7432.  
  7433. @Echo (One line of text here) > JUNK.txt
  7434. @Echo (Next line of text here) >> JUNK.txt
  7435. Rem Repeat the echo as many times as needed.
  7436. rem One arrow means make the file, two means add to it, aka append.
  7437. copy JUNK.TXT + %1 %1
  7438. del junk.txt
  7439.  
  7440. Trailer.bat
  7441.  
  7442. @Echo (One line of text here) > JUNK.txt
  7443. @Echo (Next line of text here) >> JUNK.txt
  7444. Rem Repeat the echo as many times as needed.
  7445. rem One arrow means make or overwrite the file, two means add to it, aka
  7446. rem append.
  7447. copy %1 + JUNK.TXT %1
  7448. del junk.txt
  7449.  
  7450. There are some good BFP FAQ/tutorial files floating around out on the
  7451. BBS's, as is the excellent MUF 1.7 file. I suggest you grab them...
  7452.  
  7453.  
  7454.  
  7455. -!-
  7456.  * OLXWin 1.00b * Always tell her she's beautiful, especially if she isn't. RAH
  7457.  
  7458. -!- WILDMAIL!/WC v4.12
  7459.  ! Origin: Father & Son*610-439-1509*Whitehall Pa  (1:2607/112.0)
  7460.  
  7461. ─ Area: Batch Language Programming                     FI ────────────────────
  7462.   Msg#: 438                                          Date: 30 May 96  09:04:27
  7463.   From: Vernon Frazee                                Read: Yes    Replied: No
  7464.     To: Larry Nelson                                 Mark:
  7465.   Subj: Errlevel.exe
  7466. ──────────────────────────────────────────────────────────────────────────────
  7467. VF> I almost sent you the following little ERRLEVEL.COM (& .DOC) in my
  7468. VF> last message to you.  It sticks whatever errorlevel you want in
  7469. VF> memory so you can then test for it with your BATch file.
  7470. VF> ----------------------------->CUT HERE<-----------------------------
  7471. VF> NERRLEVEL.ZIP
  7472.  
  7473. LN> TKS, Rat.com worked but it was a long way around. Am now waiting for
  7474. LN> the sh*t storm when these guys discover that we might actualy stoop
  7475. LN> to extraDOS utilities on the odd occation.
  7476.  
  7477.     <g>
  7478.  
  7479. LN> Has any body actualy found where in memory the errorlevel data is
  7480. LN> stored?
  7481.  
  7482.     Here, try this -- stick an exit code in memory that can then be
  7483.     tested for with one of the EL.BAT files floating around:
  7484.  
  7485.     1) Put what's in this     Everything in this column
  7486.        column into a file     is merely a comment and
  7487.        named GETKEY.SCR:      should not be in the file
  7488.        ------------------     ----------------------------
  7489.        N GETKEY.COM           Filename will be GETKEY.COM
  7490.        A                      Toggle into assembler mode
  7491.        MOV AH,00              BIOS read a character and
  7492.        INT 16                 put its ASCII code into AL
  7493.        MOV AH,4C              Ready to exit with code so
  7494.        INT 21                 do it
  7495.                               Toggle out of assembler mode
  7496.        RCX                    Read register CX and
  7497.        8                      stuff file size into it
  7498.        W                      Write the file to disk
  7499.        Q                      Quit DEBUG
  7500.  
  7501.     (Note: Make sure you leave the blank line between "INT 21" and "RCX"
  7502.     to toggle DEBUG back out of the assembler mode).
  7503.  
  7504.     2) Create the program GETKEY.COM by typing:
  7505.  
  7506.          DEBUG<GETKEY.SCR
  7507.  
  7508.     3) To test it type:
  7509.  
  7510.          GETKEY|EL
  7511.  
  7512.        and then press say the [Esc] key.  You should get an errorlevel
  7513.        of 27 -- the ASCII code for the Escape character.  Now try it by
  7514.        pressing say [Shift-A] (uppercase A) and you should get an
  7515.        errorlevel of 65.  Lowercase "A" would be 97, etc., etc., etc.
  7516.  
  7517.        Or, you could even use it in a BATch file that would only exit to
  7518.        DOS if you pressed say the [Enter] key (ASCII 13):
  7519.  
  7520.          @echo off
  7521.           echo Press the [Enter] key to exit to DOS
  7522.          :Loop
  7523.           getkey
  7524.           if errorlevel 13 if not errorlevel 14 goto End
  7525.           goto Loop
  7526.          :End
  7527.  
  7528.     (Note: Both DOS and your system's BIOS can process keystrokes.  This
  7529.     particular example uses the BIOS but it's just as easy to substitute
  7530.     a DOS function call.  In fact, DOS is better for some things because
  7531.     it offers several options.  It can display the character you entered
  7532.     or discard it, wait for a keystroke or process one only if it's
  7533.     there waiting, and it can handle break attempts or ignore them).
  7534.  
  7535.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7536. -!- Terminate 4.00/Pro
  7537.  ! Origin: Terminate point system (1:135/71.17)
  7538.  
  7539. ─ Area: Batch Language Programming                     FI ────────────────────
  7540.   Msg#: 439                                          Date: 30 May 96  14:27:00
  7541.   From: Roy Reed                                     Read: Yes    Replied: No
  7542.     To: All                                          Mark:
  7543.   Subj: filenames with numerical extensions
  7544. ──────────────────────────────────────────────────────────────────────────────
  7545. If anybody has a series of files with all digit extensions, I
  7546. made the following two batch files to enable switching back
  7547. and forth between having or stripping leading zeroes in their
  7548. extensions (i.e., renaming the files by changing the extension).
  7549. These batch file names may be called whatever_you_want.bat
  7550.  
  7551. Rejoin word-wrapped command sentences at the dollar signs, then
  7552. delete the dollar signs.(Two sets per file)
  7553. ------------------------------------------------
  7554. ::lead000.bat
  7555. @echo off
  7556. if "%1"=="pancakedough" goto pancakedough
  7557. if "%1"=="" goto syntax
  7558. set fn=%1
  7559. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  7560.             $$$ %fn%.%%x ren %fn%.%%x %fn%.00%%x
  7561. for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 pancakedough %%x
  7562. goto end
  7563. :pancakedough
  7564. set k=%2
  7565. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  7566.     $$$ %fn%.%k%%%x ren %fn%.%k%%%x %fn%.0%k%%%x
  7567. goto end
  7568. :syntax
  7569. echo enter lead000 file_basename
  7570. :end
  7571. set k=
  7572. ------------------------------------------------
  7573.  
  7574. ------------------------------------------------
  7575. ::nolead0.bat
  7576. @echo off
  7577. if "%1"=="pancakedough" goto pancakedough
  7578. if "%1"=="" goto syntax
  7579. set fn=%1
  7580. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  7581.           $$$ %fn%.00%%x ren %fn%.00%%x %fn%.%%x
  7582. for %%x in (0 1 2 3 4 5 6 7 8 9) do call %0 pancakedough %%x
  7583. goto end
  7584. :pancakedough
  7585. set k=%2
  7586. for %%x in (0 1 2 3 4 5 6 7 8 9) do if exist $$$
  7587.    $$$ %fn%.0%k%%%x ren %fn%.0%k%%%x %fn%.%k%%%x
  7588. goto end
  7589. :syntax
  7590. echo enter nolead0 file_basename
  7591. :end
  7592. set k=
  7593. ------------------------------------------------
  7594. For example, if you have file.1 through file.25, entering
  7595. a command of lead000 file will leave you with file.001
  7596. through file.025.  To put them back to original names,
  7597. enter nolead0 file
  7598.  
  7599.    Roy
  7600.  ! Origin: The GIFfer BBS, 75+gig, (813)969-2761 (1:377/50)
  7601.  
  7602. ─ Area: Batch Language Programming                     FI ────────────────────
  7603.   Msg#: 421                                          Date: 03 Jun 96  15:12:36
  7604.   From: Vernon Frazee                                Read: Yes    Replied: No
  7605.     To: MIKE DUTTERA                                 Mark:
  7606.   Subj: Capturing date in a batch
  7607. ──────────────────────────────────────────────────────────────────────────────
  7608. AM> I want to be able to capture today's date into a batch file ...
  7609.  
  7610. VF>   @echo off
  7611. VF>   :Sticks the current date in evar DT
  7612. VF>   echo set DT=%%4>current.bat
  7613. VF>   ver|date>~.bat
  7614. VF>   for %%x in (call del) do %%x ~.bat
  7615. VF>   del current.bat
  7616.  
  7617. MD> Okay, tryin' ta learn here. (Oh No! He says!<G>)
  7618.  
  7619.     We ALL started in the exact same predicament.  <g>
  7620.  
  7621. MD> How and/or what is being parsed in what fashion that so you
  7622. MD> magically gets the date into %%4? Tisn't immediately obvious.  I'd
  7623. MD> like to see why this worked as maybe it might come in handy someday.
  7624. MD> Thanks, Mike
  7625.  
  7626.     The line that begins with "echo" puts the following string:
  7627.  
  7628.       echo set DT=%4
  7629.  
  7630.     into a file named "CURRENT.BAT".  (DOS automatically replaced the
  7631.     two percent signs to one).
  7632.  
  7633.     The next line, the one that begins with "ver|date", will put
  7634.     something similar to the following:
  7635.  
  7636.       Current date is Mon 06-03-1996
  7637.       Enter new date (mm-dd-yy):
  7638.  
  7639.     into a file named "~.BAT".
  7640.  
  7641.     The next line, the one that begins with "for", first CALLs
  7642.     (launches) ~.BAT.  Because the first word inside ~.BAT is "Current"
  7643.     it subsequently launches the CURRENT.BAT with the command line:
  7644.  
  7645.       Current date is Mon 06-03-1996
  7646.  
  7647.       |~~~~~~ |~~~ |~ |~~ |~~~~~~~~~
  7648.       0       1    2  3   4
  7649.  
  7650.     As you can see this command line will pass the string "06-03-1996"
  7651.     as the 4th parameter which CURRENT.BAT will then put into an
  7652.     environment variable named "DT".
  7653.  
  7654.     The "del" (in the same line beginning with "for") is the next
  7655.     command DOS will carry out which gets rid of our temporary ~.BAT.
  7656.  
  7657.     The very last line gets rid of the temporary CURRENT.BAT ...
  7658.  
  7659.     and all we're left with is the following in the environment:
  7660.  
  7661.       DT=06-03-1996
  7662.  
  7663.     Pretty slick eh?  <g>
  7664.  
  7665.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7666. -!- Terminate 4.00/Pro
  7667.  ! Origin: Terminate point system (1:135/71.17)
  7668.  
  7669. ─ Area: Batch Language Programming                     FI ────────────────────
  7670.   Msg#: 437                                          Date: 04 Jun 96  15:27:22
  7671.   From: Vernon Frazee                                Read: Yes    Replied: No
  7672.     To: Evelyn Brown                                 Mark:
  7673.   Subj: COUNTING
  7674. ──────────────────────────────────────────────────────────────────────────────
  7675. EB> I read and used your COUNT.BAT and COUNTTO.BAT and all worked
  7676. EB> as you said it would. I've been wondering for a long time how to put
  7677. EB> values into the environment without using SET. I did add one "call
  7678. EB> count /o" at the beginning of COUNTTO.BAT and now when I interrupt
  7679. EB> execution with CTRL-C it will start again from zero. I got into a
  7680. EB> loop that kept going higher, even after it passed the value I
  7681. EB> entered with COUNTTO.BAT. Now for the real reason for my message. I
  7682. EB> don't understand what the batch files are doing. If you could
  7683. EB> possibly walk me thru both of them, step by step, I would greatly
  7684. EB> appreciate it. I'm not a beginner at batch files, but I don't know
  7685. EB> the "innards" of DOS well enough to use its real power. Thanks in
  7686. EB> advance - Evelyn Brown Houston - HAL-PC BBS
  7687.  
  7688.     Before we delve into each line here, each time COUNT.BAT is launched
  7689.     (without its "/0" (initialize parameter)) it appends another line to
  7690.     itself.  Each line appended contains the following two characters:
  7691.  
  7692.       :1
  7693.  
  7694.     All we then have to do to find out how many times COUNT.BAT has been
  7695.     run is use FIND's "/c" (count) parameter -- like so:
  7696.  
  7697.       FIND /C ":1" C:\BAT\COUNT.BAT
  7698.  
  7699.     If COUNT.BAT had 16 lines containing a ":1", FIND would display:
  7700.  
  7701.       ---------- C:\BAT\COUNT.BAT: 16
  7702.  
  7703.     That's really all there is to it.
  7704.  
  7705.     Of course, if you'd rather display something a little less confusing
  7706.     you could then:
  7707.  
  7708.     1) Capture FIND's output to a temporary BATch file, say named
  7709.        COUNTEMP.BAT:
  7710.  
  7711.          FIND /C ":1" C:\BAT\COUNT.BAT>COUNTEMP.BAT
  7712.  
  7713.     2) Create another temporary BATch file named "--------.BAT" (eight
  7714.        dashes) that will place its second command line parameter into a
  7715.        temporary environment variable, say named COUNTEMP:
  7716.  
  7717.          ECHO SET COUNT=%%2>--------.BAT
  7718.  
  7719.     3) If we now launch COUNTEMP.BAT its first word is ---------- which
  7720.        subsequently launches --------.BAT with a command line of:
  7721.  
  7722.          ---------- C:\BAT\COUNT.BAT: 16
  7723.  
  7724.     4) --------.BAT then sets environment variable (evar) "COUNT=16"
  7725.        with its command line of:
  7726.  
  7727.          SET COUNT=%2
  7728.  
  7729.     5) Now display what's in evar COUNT with the line:
  7730.  
  7731.          echo Count=%COUNT%
  7732.  
  7733.     6) And all that's left to do is cleanup our temporary files.
  7734.  
  7735.          FOR %X IN (COUNTEMP --------) DO DEL %%X.BAT
  7736.  
  7737.     Now on to your request:
  7738.  
  7739. 01  @echo off
  7740. 02  :COUNT.BAT - Increments COUNT evar each time run - (Self modifying!)
  7741. 03  :
  7742. 04  :Note: All occurrences of "c:\bat" below must be changed to match the
  7743. 05  :      "drive:\directory" where you will be storing this Count.BAT.
  7744. 06  :
  7745. 07   if not (%1)==(/?) goto Begin
  7746. 08   echo Purpose: Increments COUNT environment variable each time run.
  7747. 09   echo  Syntax: Count [/0]          (Optional "/0" means initialize)
  7748. 10   goto End
  7749. 11  :Begin -------------------------------------------------------------
  7750. 12   set count=1
  7751. 13   if not (%1)==(/0) goto Count
  7752. 14  :Initialize --------------------------------------------------------
  7753. 15   find /v ":%count%"<c:\bat\count.bat>c:\bat\count.tmp
  7754. 16   copy c:\bat\count.tmp c:\bat\count.bat>nul
  7755. 17   del c:\bat\count.tmp
  7756. 18   set count=
  7757. 19   goto End
  7758. 20  :Count -------------------------------------------------------------
  7759. 21   echo :%count%>>c:\bat\count.bat
  7760. 22   find /c ":%count%" c:\bat\count.bat>countemp.bat
  7761. 23   echo set count=%%2>--------.bat
  7762. 24   for %%x in (call del) do %%x countemp.bat
  7763. 25   del --------.bat
  7764. 26   echo COUNT=%count%
  7765. 27  :End (COUNT.BAT data storage begins on the next line below). - -vjf-
  7766.  
  7767. [...continued in next message...]
  7768.  
  7769.  -- NetMail: 1:135/71.17 E-Mail: vernon.frazee@sunshine.com -vjf-
  7770. -!- Terminate 4.00/Pro
  7771.  ! Origin: Terminate point system (1:135/71.17)
  7772.  
  7773. ─ Area: Batch Language Programming                     FI ────────────────────
  7774.   Msg#: 438                                          Date: 04 Jun 96  15:29:29
  7775.   From: Vernon Frazee                                Read: Yes    Replied: No
  7776.     To: Evelyn Brown                                 Mark:
  7777.   Subj: COUNTING
  7778. ──────────────────────────────────────────────────────────────────────────────
  7779.     Line 01: Flips the echo off which keeps DOS from displaying each
  7780.              line of the BATch file as it is being executed. The leading
  7781.              "@" symbol keeps DOS from displaying the actual "@echo off"
  7782.              line before it gets a chance to toggle echo off.
  7783.     Line 02: The ":" symbol is usually used to tell DOS that a line is a
  7784.              LABEL (as would be used in the BATch command "GOTO LABEL").
  7785.              It's used here simply to keep DOS from trying to execute
  7786.              the line because it's being used for a comment instead.
  7787.     Line 03: Blank line comment used as a visual divider.
  7788.     Line 04: Again, since the line begins with a ":" DOS thinks it's a
  7789.              LABEL and ignores it for now. (Hence we can also use ":"
  7790.              to start our comment lines).
  7791.     Line 05: Continuation of the comment beginning on line 04 above.
  7792.     Line 06: Blank line comment used as a visual divider.
  7793.  
  7794.     Line 07: Check to see if the user entered a command line parameter
  7795.              of "/?".  If they did NOT, it's jumps to label :Begin.  If
  7796.              they did, it falls through to the next line ...
  7797.     Line 08: displays the first line of the brief 2-line help,
  7798.     Line 09: then the second line of the brief 2-line help, and
  7799.     Line 10: then jumps to label :End.
  7800.  
  7801.     Line 11: Label :Begin.  (BTW, DOS ignores everything after a space
  7802.              (and anything beyond 8 characters if there isn't a space)).
  7803.     Line 12: Set an environment variable named "count" equal to 1.
  7804.     Line 13: If the user did NOT enter a "/0" on the command line, jump
  7805.              to the line label :Count, else ...
  7806.  
  7807.     Line 14: fall through to line labeled :Initialize. (IOW, we're
  7808.              preparing to reset the count to 0).
  7809.     Line 15: Environment variable "count" currently contains a "1".
  7810.              FIND's "/v" parameter means DON'T find something.
  7811.              Therefore, the command:
  7812.                find /v ":%count%"<c:\bat\count.bat>c:\bat\count.tmp
  7813.              means: "Yo! FIND, using C:\BAT\COUNT.BAT as input, (the
  7814.                     '<c:\bat\count.bat' part), look for all the lines
  7815.                     that do NOT (the '/v' parameter) contain the two
  7816.                     character string ":1" (what's in evar 'count'
  7817.                     prefixed with a ":"), and, instead of displaying the
  7818.                     results on the screen, write 'em to a file named
  7819.                     C:\BAT\COUNT.TMP (the '>c:\bat\count.tmp' part)."
  7820.     Line 16: Copies the temporary file C:\BAT\COUNT.TMP over top of
  7821.              C:\BAT\COUNT.BAT. (IOW, any lines that were in
  7822.              C:\BAT\COUNT.BAT are now missing because we used FIND to
  7823.              search for everything but some unique something).
  7824.     Line 17: Delete the temporary file C:\BAT\COUNT.TMP.
  7825.     Line 18: Remove evar COUNT from the environment.
  7826.     Line 19: Goto line labeled :End.  (COUNT.BAT has been initialized).
  7827.  
  7828.     Line 20: Beginning of the Count routine
  7829.     Line 21: Append the two character string ":1" to C:\BAT\COUNT.BAT
  7830.     Line 22: Use FIND's "/c" parameter to count the number of lines in
  7831.              C:\BAT\COUNT.BAT with the string ":1" (what's in evar COUNT
  7832.              prefixed with a ":")) and send the results to a temporary
  7833.              file named COUNTEMP.BAT.
  7834.     Line 23: Put the string:
  7835.                set count=%2
  7836.              into a file named --------.BAT
  7837.     Line 24: First, CALL COUNTEMP.BAT and then DELete it.
  7838.     Line 25: DELete --------.BAT
  7839.     Line 26: Display the number left in evar COUNT by --------.BAT.
  7840.     Line 27: And that's it, we're outta here.
  7841.  
  7842.     BTW, when there are a mess of
  7843.  
  7844.       :1
  7845.       :1
  7846.       :1
  7847.       :1
  7848.  
  7849.     lines at the end of C:\BAT\COUNT.BAT, DOS will ignore them because
  7850.     they each begin with a ":" -- line labels.
  7851.  
  7852.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7853. -!- Terminate 4.00/Pro
  7854.  ! Origin: Terminate point system (1:135/71.17)
  7855.  
  7856. ─ Area: Batch Language Programming                     FI ────────────────────
  7857.   Msg#: 446                                          Date: 05 Jun 96  14:04:58
  7858.   From: Vernon Frazee                                Read: Yes    Replied: No
  7859.     To: Larry Nelson                                 Mark:
  7860.   Subj: Errorlevel.exe
  7861. ──────────────────────────────────────────────────────────────────────────────
  7862.     The enclosed SETEL.COM (along with SETEL.DOC) is actually a XEQ.COM
  7863.     (v1.15 COM File Library and Command Executor) containing all 256
  7864.     6-byte errorlevel-setting COM files.  Storing them this way instead
  7865.     of individually can save tons of room on your hard drive.
  7866.  
  7867.     Each of the 256 .COM files within SETEL.COM can be executed in place
  7868.     (while still within SETEL.COM) and each will still do exactly the
  7869.     same thing -- place the errorlevel indicated by their filename into
  7870.     memory.  e.g.,   SETEL 96   will place errorlevel 96 in memory.
  7871.  
  7872. [...Part 1 of 2 of file SETEL.SCR...]
  7873.  
  7874. ----------------------------> CUT HERE <-----------------------------
  7875.  NSETEL.RAR
  7876.  E100 FC "+"ED BE 8B 1 B9 F5 FD "+"DB 8B D6 B4 "?"CD "!riP"8B DE 8B
  7877.  E117 C8 AC "<*"E0 FB "uP"B4 1 80 F4 1 "<"A AC "u"FB "<>t"F4 A E4 "u"
  7878.  E130 F3 E8 "'"0 "*"F6 3 EA FE C6 B1 4 AC "< v"E3 E8 17 0 2 D2 2 D2
  7879.  E148 B5 6 D1 E2 "s"5 88 "7C"B6 1 FE CD "u"F3 E2 E3 EB DF 8A D0 BF
  7880.  E15E 80 1 2 "U"FF "*"15 "r"7 AE "r"4 AE "s"F3 C3 "XZ"B9 FF FF F7 DA
  7881.  E175 B8 1 "B+"DB CD "!"8B CD CC 0 "+,-.0:A[a{"FF
  7882.  G=100
  7883.  W18B
  7884.  Q XDS 1.3mp by Horst Schaeffer
  7885. *XXBUG20--000016AE--04061996--FD5DABFC------------------SETEL.RAR
  7886. nIa3m6Fc5+1jEQkU+1E++++++++-FULE+U0Y+FlA++0QN++++NB134E+6kG+DBEY+6+++
  7887. n+3B3J2JA9YBDHEzPqOjiTR5MPbUjf992b2TlK+Djzsfyz2pj1tC6OTtySl2waxkrTyjA
  7888. nSImhbrzbLRTWctmLa7KUYQl5rRtTFvayVM-yGNh8CBbb+XOufrkM8sVUkRenhA+z0QgH
  7889. noIxkFykabQG2S2Es2v2-iF6wV-VTD+DPBPJcSntNECQzoRbBn1hNB5Dm4urRyaDU6X7z
  7890. njNo59HZBncJ5zZtWtZe8Xrp6lQUyTVvD1CLA7WsRtgIEZTOyP-xaPEzaHIkzIz3iB8o1
  7891. nWV3oUd-Y7wpzbYaXu13zpODmAjGoP7uztUokmiOrUpUMzX93DsYMurGH+z2pZcVTe3oT
  7892. nEyWqQffwzgD-2iwS+RSMPPqYzi-kHqJK6ObLaAa1-5yb+S+dHH1zY3rECxVPC8ULiYm-
  7893. n0j1nMqlbi-uWKFllDTdCKwgiAzFaD00+ksbP1wknk+4tR0ELi5weA0Gs2Pnses48SIGB
  7894. n1OULqHMdqFgyTlK6khCFmTbLRE1BIz2gjJ-HAzKDdmd8-zu2-x-r-GDsVcdQ1cunZVB+
  7895. n4ITnYSG1GCCeBzjuOAOY1EEAtmX3+x80eaCt6Td0VUPf-T3bQxDYrG-BtuLE9y-Ijwkf
  7896. naOAfUUk6pAcv+Qqy6M0d+x0HdTnuuQQA7pxlQCEY5Ieo7IXP8RNi62UFOXoUZon5zlYw
  7897. nYx0NDJ+nDDpZ123RkM21V1FRO8RtRA4zE4x9BfAja9L5lBZ3pKQMJTZ7zsvYhUWP5M+C
  7898. nIeRQIpxmULztG6wjh25xv9-VvDFHdDsOa1YTRtTMZyNc-Q-ctCGBteCceQcfZv90dZ8s
  7899. ndcwxawgLFuQgc14uIcYdf11d6Ti0O75k9+dCtSQNrFV5icpE9YY+ScM68OuAGB2dQwgz
  7900. nE7YcZfkdrK60JEhDtGPfd5mFrjVl7fUWW4WtvClVjAQ53KO89+6WcdQZJ80E-2bUQQCs
  7901. n8iRO6Mi-lhIr4J2eJpFoduQ83-ckQJQM7bP4+MvaV61vx66rdOSmA8sGRlW7qH2SMtB2
  7902. nNa6Et-TxYrFGb4dde5sf6YKB5CuGApJYgun3rhuMztAzjZRf4-5zQia5qwSwNvYOXYu6
  7903. n+O1FLrQ14TkGV7LknBQPk4ikQRkdFQqdDhH8Q7moKTyzfgozoTPyvdKYiggAwXBnn1QV
  7904. nP4IB5wtSQ3qmMsXIPWF3USZkW-HWrDq4yQqiHBNbRFYhR07ryFgQnh9QHf9qcalzceF+
  7905. nkT+Kt6CGecN8I2ijRcoG7zqVGXbgMIeflhBYB4u5Tiu6TCe3vm0b6kNbWHEeH0uyE7Z+
  7906. nw10xTqLQxsHd8+k7Ea7ZCMvxlPjay87diEeqJUm2xVComH51zb8J9xEVGwF9Y-i7HtPj
  7907. ni6T+NNR5mCmYCf+ul3aieaUbCq70Mb6GfL2ETy7lgpuGhZpJBJclJgVlxaEMt1X8ctJ7
  7908. nytcFvfGmgx0KtNTWHz+GLC0eJoOX70GiE6292XZef4BdTGtm-UKipSg6lRIg3VwYg52j
  7909. nsmCbgxPTSAC+HtZdkG4BMFCFkiA73PEcXjHxdkKd76WybExbzfsF-Uyj1w5IHGu9KxUd
  7910. nxW0y2Vhtm0M3Ytenq-DtwhDJH0Az8fGgj8PzyV3BnWrvOaRp2QyBdILw7eIlHnFOa6yV
  7911. n04QrIXWMYShN5ob1J70Uo8ql7GVraWZ8SkrDHlGNIs78jts5Rja9FKixCUJo44sYe6cf
  7912. nu4wyiZYa4D22D0YVYUdygG2b6GEZQKXZu-7TZ0FL5cmOsgLn-1Lz6jeua82d95JDSqDt
  7913. n7rYW3Q4X04rR-UioMX0dlIIrmT5YsPrr7bZQecbDAMqIJlcNQXlAVC2xiDJwwD21WgFW
  7914. nH59jvXUGMHD1qS5isb5rTBvlHcuh-LynmMDT7-IV9eVDOCs1G5EtPXNI6rs3BxAz1yEZ
  7915. nt0dnYLW1fDA9xS5q65xGSCu2dlnXS1mY1Zjd1TFL4q1LlVMnnfvM55PXd4IKLhj2QwgM
  7916. nbTQxICgYO6bkYuYh9kSvKGdeO7VAafisSq35pWRkM1I-WPyrH16QFk7apdOf1Y18oni4
  7917. nDXm0f7IVWa8SXnMiDm2RooVVLA21f5ZSsjeSdA-MJkPmyosjo+4RjuVhrZDTO8hBMlT-
  7918. nnSA8YxehqryXsGMtMKz5qTAkEN11LRPmi5Bp7Sz6yQ-8pLTyZljnFZP2zA+w4oze0Tgn
  7919. nyBUBGiqmzbhYoHVAyiiN8EXqphPkLEPmH9SGI4gXcT3AfNB0nqXLsxWSET7RPGIabpNz
  7920. nB6Ge1wd7nhjdCuAnzkK2fISUYV92g3AVuDJh8Mk727Vq2TgHtfp4ni5PEiODfEZJgMCI
  7921. nEb47V+79PCupA0xu+dSUe4Aka2Q5ABXIGN6IiJBh1p7yCca0fHNj00l4XAeSPIF88gj6
  7922. n4lNS9zLtgXRJJ3X8qZxphDqr8ICzooz3mI8Cuvv7c8hY-WSXrCEaWwXGO079I-SZysGM
  7923. nHIFjpnrFEki+aALxPzlEXu-zyQITgMJiHqlX0q0oXCOUoaD7h6hBi7s8k7Syl-9Pedra
  7924. nV7P3D83hE54GJ+EwZ0mAtiuRxWvxXrqrNkADdri1bTbtsur81iGe-4wJ2byW0fgjxGRV
  7925. ns4-psNEGIzay+kwATAa7JRRk0wnyv+wekA4yaXBOMb0taeLmMx+hPKAyVoeloMrQUFLO
  7926. nD070Lo5FW4CNe64XwOgqHpLO6efVaPKxtNE7OGeDkgz3aBSKK3jBcPNyI93C0YXWR1o-
  7927. nxDabZh9kbXC3eTG-1+bni6qYUPzvqZFRHcVQOWpljeIOK75G0eMgJB883iNQ8gkaEbMB
  7928. nLZ2xP47TMhyOoYiEV8ushhGJYVq5ZXMxTzt482PdLOyPbg8afGwluAN9-190efVf9Nwc
  7929. nTx541lDawkrG6x-MATdAqFOcwn3bl+om51d4kagysfPV2+G-6vOkLD3i5TFCZt4AVQwl
  7930. nKhaViFSj0gPcnISjf7ovTfGaRyWGEFtQ7IPYmCui-jm56QsnWBvtQPVo5aV7X+60Yf8w
  7931. nsqIeSPCttwdB7BpYeH-d7yIWQIdcdIwnJpxBM1TMkbpt55k4-zn+W9Apk4P+QdBI7gq6
  7932. nSBb24d9IUHq4cXK2rO-Z6aG-OQeVbF8vPd7qMDghY2BOjf3AT5LzonV9snV6Ohlz3usq
  7933. ne81Fi3wUMyjrsLNjNhlwOzjAw7EBCeDBQ8l5xzCzwy53IVg6mEqLA2unhaZ-Kip7Jf0H
  7934. nBokHYqhOUoKys43qOzClLqqUhXWD22BxXmTJ8-WKS9dWNpGlUDiaw3g5vDzVO9-uUikp
  7935. noSQAgGz8wUsjuzUSEdDdWjsVjiQK5vXahx7x6Yi2qweaYQnOk13mg0GzIqIDy3KoGA2O
  7936. nfnvgK9Ynru8Cdr5kiTE2Gope7d2ayMffYQby8uHqoJlXtIzhavA9jLM562ekpQ-CPQA6
  7937. nQSTWSroBxkS9Da7YMAekozZWy8GAuPJLGHXJ+Q5n3o6snK+mqGGM17mJdjS5jVNT6xfD
  7938. nJT3GS+l9l+wxByKGkEVjim5MGpNK9aDqpjxmI2dftr60IVgT0zTchbgtCqGvbS5WNzjQ
  7939. nv0-3oNoKPrMHzl9OgLTb2O999VTUZkQzxlL5WG1eUPkka7EO2biJWEvWBRO3z-KgsoA5
  7940. nWT91Q6SHl18VoiDlHAX5vh1BlBpCpUalkZnfwu96NDc1VVy58scLy37848Vqy7roDJOz
  7941. nemlnueg+TGQYVZPfmX4S7zBApGY4ewQj6FBdY2wLUB4Ufksuzc7OuxC+ZoBr1bmPsCik
  7942. nRWjiWgcS9zCNsTSlKSKWzxzBv-4OYT0v8w8XAecf1-ydJREQ7Qj5UEmgQhc0w5t-T6DG
  7943. nP+Z3Kvc7C8EwH7cSYncerR3xlbEsrwQNppC-p4TkqTPPqcZRbdDS59shhI-ODvl1xX+Q
  7944. nDuX1G+jr13gALwseYUu4ORDRpHLd8OQE4z7ewTasATs4qSKjuj3Ox+NIuC+OQzEYhVH2
  7945. nFp34QnwDouDQvGtzTGYr4GmLyYKRFMTxjwFEgfhTlUKuyhxuHxDyRa2PC1CbGQWXzS-Z
  7946. n3BF9nyqSW48fqkzbT3vfXu5Wt6dn0yHh+kqY0SjVp0cgU7Q+LzoqLVP1Mvs7D3hrHSkf
  7947. nUWmlbddVK6OoBPxdCgexU4JgAYN05svTbj7SuAwLKYkiX+Md3QPCTzWM3TI1LQPwMAnz
  7948. nMGLQI0S76qkGNg2WTBlTGGYZ2eGAHS-D2-O3sBEQfLliJjK+wu5ZbgL5aq4CkuclUr8c
  7949. nOr9Gq0NjZ2KEi2xGGSMELwYe7zjI4tswGJoGFzArZfNmg+JfdHGqABlCs7dKwcA4EAPo
  7950. nlb4-PTZj72wG4nFYR3cTOXFPH7kpIc184vRXEOayc2WkLubcbw6ANXQa582ayBvQ4L9m
  7951.  
  7952. [...Part 2 of 2 of SETEL.SCR in next message...]
  7953.  
  7954.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  7955. -!- Terminate 4.00/Pro
  7956.  ! Origin: Terminate point system (1:135/71.17)
  7957.  
  7958. ─ Area: Batch Language Programming                     FI ────────────────────
  7959.   Msg#: 447                                          Date: 05 Jun 96  14:05:22
  7960.   From: Vernon Frazee                                Read: Yes    Replied: No
  7961.     To: Larry Nelson                                 Mark:
  7962.   Subj: Errorlevel.exe
  7963. ──────────────────────────────────────────────────────────────────────────────
  7964. [...Part 2 of 2 of SETEL.SCR continued from last message...]
  7965.  
  7966. nO56J0WNg7hB62h0V7V4VodLBI+SEntPqdGAXa0ohexFtXyK5v7C0Q87ArTn5EFGjWXy6
  7967. nHVJzSWTt8ZRGpJoFROKbc4GypQxcGZ5FS2aHE10R+xUYeiFmad2UksUx+ZIH9bMgYH8H
  7968. n-lkWWIcGb0JkwhNpAPUQZXBiITzhatj32XQEutdKOWfpCcVGaA9vy2UgYHa0mAz0MOVA
  7969. nGqZlL39-lApvz3nCNjCmRWviDjeXg7FfMZJMgOZ4Ud8SPXH7LMoIVqVcYn0TlhQOAx7B
  7970. nQ-cHMn6gjocmnyTSYJtUJGLyDsdfMJAbGsi6kV0Mkad6xICaYI435OycwpChFnODnuop
  7971. nqFn7wrzFb11aRK1qINtxY4MOSFqIYWbYRAGDsO7YMmQjAbdugGP9sTBasSLaF721Giks
  7972. nmHkopLr696hCtKSez5YwZCuDaPehUUHtQ96UeM70WQnascTUwTtJ8FMz3tKSe6hxbB1-
  7973. nVhS7qyRArNmNcFGNW6sg2YHVMHHqodOkZEmvAFZiUGNzxRvkkpk7mNdb9kKtHBhlrBQ9
  7974. nAPZIYk7TL989aT-bQG400t9XA2oZCHzCqeCJ7wsZ8kkNJ-ERM7-BiPeGYWhS4RhtJDwu
  7975. n2fNeqh8KVKJQL7sJJylH7sOKp4g6aLIeLMv1naedDxdu2lyGSIVB7kKTmZG1UUwWigwC
  7976. n0SdAqr4vQPCLWZ7a0aAwB+oZDu9Ufk3MApvmYrnEVodMMDuwTaD8ADvEsLfGSz090Bkl
  7977. nAZMm4aZhWFemnF1ujtN7BbC5jzuAtX4XouFU+Z7ThXTubaUzA4X2jQzmUYomouAXvVlR
  7978. nB2uGGmcY51CMl78EifoIS-WTkFzrGwzZTT7GzKDyqDUzEKZDBlbpNs24Sp79SaHtwuip
  7979. nzdK60p7ATmZY6DqL2Z6luHjTo5M9JslCsfJdagZG90JgDE0m-LfYcA2D4lqOzMrPErkY
  7980. nroC6JMlQLrFQygbsmeoAkRYleLciw8oWjfCzQDRXWnomcHzeFxtJk2wu-9Vq39W2Dhs8
  7981. njAnMjRSzmXmg0bQ4Ohf1jon0GOp-G3DM-ARkD65ihONqHcZLlPlNSWtuIaAZLvlxIxs6
  7982. n0ZqzEzTifzKOr2Qi8ci3-b5dEP9t-Ygx-XyCO0J-qyWSuX7GUal8byJ4UiMp5m7JD566
  7983. nk1M7TM2slCv6P6gnPmfqRdjv-BL1GCWJ-wqKg-6U+fQ9NrIWUswvu7Jn0xNpApOZ4jDB
  7984. n8dXDOIsr+4CCxvCTUgmyGfnmN1pZgITybc3daPaIAYyv0+pqnTk4ZjSJ+C+RigNKWXMb
  7985. n2vP9f4pIYxHs5uU+CTdfJmN2l6IPDsZyVnelPGJVp8YC5P7cE1euNag7HCLWW83fUYdY
  7986. nI-++K++cI30GYQYagiUN+JyGpk+YyHIrQJ3+5LF+1lv-lE-l4LmS+w74Z6lljb288kml
  7987. n910VsYi31HwjQH-OUpc2q5u8EHWUf4Gk8sWPwKJpd5QF1IsL1IaQjqoFM7BiYdOFX+D4
  7988. n+2A+8QT74ST6JCjgYttDhM3nGzQbkO6rUgqJHseQhkC0+ETe1zcg5UiBCpg8PaANQ4Qy
  7989. n+82Fuwb5McdE-6x2Xds8ED1juY3cyV5WXVJ9ffGs0k1pl5caghzDbaqH4hPW4QEI2236
  7990. nynwrigmMiK3jBs7xv4AXvBWTuA91PET4IHl8fH-s5B1H0osv-hQGEi8W4OI5HdtvzDG8
  7991. nWMATA+VrvQO2vdTxwnxVfoDY71JW9p9XJm2-i67jy330yY++wL0D4dAy05-KQWCMCPyb
  7992. n8WmCoStmUZ5cw7wArJuKy5yYGlBN+zzg1vT-GlImYtmSQqA+KuLbEHmGXMAus56zD3km
  7993. n8WScICYcIwcIZUdD-Lp2CSG37qHgXS2AbFjQ2cZXql7ZEfQVAaxdr+OtuGaneDyrVqFL
  7994. npkLQHsZc46CuK0UjKdp1aDvBWcgHSzNP9Q76Ovv50ira6L4aLcD7u+QXSw-vl6bOowHD
  7995. n-ccdsXTLh8Ga1mp2sfur3dXDFPPVN5Net4cHrt6KeLYZ3yO3Pw8tesj1Px2rPhdy16JL
  7996. nhL7L7uO4UaK7e9oEhuHJUUiZF9xX5A0Wgx7UYGAPDiWeUAdvTXNSV09-xfqmPwoUSjiu
  7997. ntChmZy4BVOZPP5ZLak2+1Y4aNu9zN-voxcJWBWuwdrjZ4owfdZbqGj62tXiVkMh6kMHh
  7998. n4a1PxUb3xrIiqQmYwV2kYNEYbmyFWDeBsWZ54wcu7BTSthHjNtJpx9wYBH98JXINckfo
  7999. nR+0+8E+-+k++wEM+++0dlo-f++X-6+wp0E+U++++IoJIFIkiF2x1ypC-gh3TQ-Kf4YUG
  8000. nS-zyizbdpyT95ysEvGodKEKRDu5H-PhT9UhS3XrwfjdD5ZUhMNxoAm-cC1qCo056VgcT
  8001. nvta42txHufGBEM9eZCMenhOOeIrocLAmtz32CNknY6I2k-Jr2mNOzHHe7PVaswQW73mF
  8002. n0wHH8M9Y0kO8xke+JaVZcCYx8JK2Tqh5RXRG-Qd6JADFv3zjt1Oduya5NwipNTRow0d2
  8003. nYArf9-FClVw4oMMRpsP4XfxXoKJsTtPy2VX-Nk5DhgQXOwj3Tf50flINmKwJuhl+Rjlf
  8004. nSu3+rsrMrilJ343dkNti4GJ6jSdYIhkkjsEuzMbkW317BeHi7UHbhWJh4jbapp4T1qKA
  8005. nNAqzGAxB-k8Iflq0cexT+bQfkZ0JkSHnBYifP6F0Ke2N7NIAWizjNBz6HKag2BMYJAsL
  8006. nssiWKOBszD6lZdPdMOmCQg2xC6Le1nRzBOVBvLwirpjN0BQ9YJydwAaNOfkUyoekFf+D
  8007. neJozr0C1QXZoUn1t4v1dvmZmq4bUlCK2YKJ1YHboNYfoaDwqxgRz7w0Pyv5A3EWYcI1g
  8008. nOXHtTwqOkWWbKt+CZTMaJ3pd0JaEBidgwNhNq36arpXSpOtJGq-VBDESBfZnnVhz6iKB
  8009. noXDJIvVstLrSW90cJMZ2vakN8kQVxlG+v56VhiFySKpzAhHuEEWSqIXEMpbDy0BR14ai
  8010. nkSJ41ziB407iDF09Tp82S8tM3PXRBQtXAN3ao38S7OeqGBYm2VytEO-VdpHmYO+kT6Kh
  8011. nk0HqT87+WCpgvJrp5kujxj4qKp8jYZV8ReWuHzywL28pRdz+hMetJhuQd5c5BHJ4dnC-
  8012. nQt33QJ2er0OslY+I6qGmyUAfIfwpqz8wQPblP3keYW6Ut9Z1Eb1gkYe5pFY4F-q-JbCs
  8013. nVUgE-78bzXu8lXqqpoqmrrKmkEx-Bcih25tlet-Az071TjWP8jup2VLJfQUOp9BtJWnn
  8014. fnwIm490FtnOJ5a4Wm1ntMAZQ639+ifRIOatIXlWwRP7Q6EFsq7vNMZFanQUO
  8015. *XXBUG Version 2.21 by Chad Wagner
  8016. ----------------------------> CUT HERE <-----------------------------
  8017.  If you have downloaded this script file, remove any captured
  8018.  communications header and then enter
  8019.  
  8020.    DEBUG < filename
  8021.  
  8022.  where filename is the name of this script file.
  8023.  
  8024.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8025. -!- Terminate 4.00/Pro
  8026.  ! Origin: Terminate point system (1:135/71.17)
  8027.  
  8028. ─ Area: Batch Language Programming                     FI ────────────────────
  8029.   Msg#: 448                                          Date: 05 Jun 96  14:05:42
  8030.   From: Vernon Frazee                                Read: Yes    Replied: No
  8031.     To: Larry Nelson                                 Mark:
  8032.   Subj: Errorlevel.exe
  8033. ──────────────────────────────────────────────────────────────────────────────
  8034.     Summary:
  8035.  
  8036.     MAKEL    BAT     894 06-01-96   1:00a When launched with a number
  8037.                                           between 0 and 255 (inclusive)
  8038.                                           on the command line, MAKEL.BAT
  8039.                                           will create a matching 6-byte
  8040.                                           filename with a COM extension.
  8041.                                           When this COM file is
  8042.                                           subsequently executed it
  8043.                                           places the corresponding
  8044.                                           errorlevel in memory.
  8045.  
  8046.     MAKALLEL BAS     627 06-01-96   1:00a Creates all 256 6-byte .COM
  8047.                                           files, 0.COM thru 255.COM.
  8048.                                           When each of these COM files
  8049.                                           are executed they place the
  8050.                                           errorlevel indicated by their
  8051.                                           filenames in memory. (e.g.
  8052.                                           96.COM sets errorlevel 96).
  8053.  
  8054.     ALLELCOM SCR   6,084 06-01-96   1:00a ALLELCOM.SCR contains
  8055.                                           ALLELCOM.ZIP which
  8056.                                           contains ALLELCOM.RAR
  8057.                                           which contains all 256
  8058.                                           6-byte COM files (0-255.COM).
  8059.  
  8060.     SETEL    SCR   8,967 06-01-96   1:00a Contains SETEL.RAR which
  8061.                                           contains SETEL.COM and
  8062.                                           SETEL.DOC.  SETEL.COM is
  8063.                                           actually a XEQ.COM (v1.15 COM
  8064.                                           File Library and Command
  8065.                                           Executor) which contains all
  8066.                                           256 6-byte COM files. (Saves
  8067.                                           room on the hard drive).  Each
  8068.                                           of these, when executed right
  8069.                                           from within SETEL.COM, will
  8070.                                           place the errorlevel indicated
  8071.                                           by their filename into memory.
  8072.                                           For example, use the command
  8073.                                           SETEL 96   to place errorlevel
  8074.                                           96 in memory.
  8075.                                           Syntax: [d:][\path\]SETEL #
  8076.                                           (Where # is any number between
  8077.                                           0 and 255 (inclusive)).
  8078.  
  8079.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8080. -!- Terminate 4.00/Pro
  8081.  ! Origin: Terminate point system (1:135/71.17)
  8082.  
  8083. ─ Area: Batch Language Programming                     FI ────────────────────
  8084.   Msg#: 445                                          Date: 10 Jun 96  20:23:00
  8085.   From: Ron Warder                                   Read: Yes    Replied: No
  8086.     To: Axel Merkel                                  Mark:
  8087.   Subj: arj & delete
  8088. ──────────────────────────────────────────────────────────────────────────────
  8089.  > i'm looking for a batch that will do something like this
  8090.  > checking one directory like arj t *.arj, and if happends a CRC failure,
  8091.  > deleting this file
  8092.  
  8093.   A good start would be to familiarize yourself with ARJ's different exit codes
  8094. (also called errorlevels):
  8095. ----------------------------------------------------------------------------
  8096.   (From ARJ 2.41a docs)
  8097.  
  8098.                                ARJ DOS ERRORLEVELS:
  8099.  
  8100.        ARJ returns a number of DOS errorlevels for different situations.
  8101.  
  8102.        0 ->   success
  8103.        1 ->   warning (specified file to add to archive not found,
  8104.               specified file to list, extract, etc., not found,
  8105.               or answering negatively to "OK to proceed to next
  8106.               volume..." prompt)
  8107.        2 ->   fatal error
  8108.        3 ->   CRC error (header or file CRC error)
  8109.        4 ->   ARJ-SECURITY error or attempt to update an ARJ-SECURED archive
  8110.        5 ->   disk full or write error
  8111.        6 ->   can't open archive or file
  8112.        7 ->   simple user error (bad parameters)
  8113.        8 ->   not enough memory
  8114.        9 ->   not an ARJ archive
  8115. ____________________________________________________________________________
  8116.  
  8117.   So, to trap a CRC error in a tested ARJ file, for example, you would need to
  8118. test for errorlevel 3. Note that errorlevel tests need to be performed in
  8119. REVERSE order to work properly.
  8120.  
  8121.   As far as the structure of the BATch, I myself wouldn't -delete- the file,
  8122. since ARJ has some built-in repair capabilities. I would, however, MOVE it to a
  8123. holding area for further processing/repair efforts. But, hey, you wanna delete
  8124. it, no problem!
  8125.  
  8126.   Pull the text below into your favorite ASCII editor, and save the two batch
  8127. files shown below as ARJTEST.BAT and CHK_ARJ.BAT, respectively. Remember to
  8128. join the two lines in CHK_ARJ.BAT where indicated, otherwise, that part won't
  8129. work as designed.
  8130.  
  8131. ::ARJTEST.BAT --------------------------------------------------------- @echo
  8132. off
  8133. for %%a in (*.arj) do call CHK_ARJ.BAT %%a
  8134. :end of ARJTEST.BAT ---------------------------------------------------
  8135.  
  8136. ::CHK_ARJ.BAT --------------------------------------------------------- @echo
  8137. off
  8138. cls
  8139. echo       Now testing %1.'s integrity, please stand by ....
  8140. arj t %1 >nul
  8141. if errorlevel 9 goto ERR9
  8142. if errorlevel 8 goto ERR8
  8143. if errorlevel 7 goto ERR7
  8144. if errorlevel 6 goto ERR6
  8145. if errorlevel 5 goto ERR5
  8146. if errorlevel 4 goto ERR4
  8147. if errorlevel 3 goto ERR3
  8148. if errorlevel 2 goto ERR2
  8149. if errorlevel 1 goto ERR1
  8150. goto OK
  8151.  
  8152. :ERR9
  8153.   echo   File %1 is NOT a valid ARJ file!
  8154.   echo File %1 is not a valid ARJ file. Please check this file.>>arjtest.log
  8155.   goto end
  8156.  
  8157. :ERR8
  8158.   echo   Not enough memory to complete operation!
  8159.   goto end
  8160.  
  8161. :ERR7
  8162.   echo   Invalid Parameters. Please check commandline!
  8163.   goto end
  8164.  
  8165. :ERR6
  8166.   echo   Unable to open %1! Check spelling and make sure file exists.
  8167.   goto end
  8168.  
  8169. :ERR5
  8170.   echo   Disk is either full or write protected.
  8171.   goto end
  8172.  
  8173. :ERR4
  8174.   echo  ARJ-SECURITY error or attempt to update an ARJ-SECURED archive
  8175.   goto end
  8176.  
  8177. :ERR3
  8178.   echo  CRC error! %1 is probably corrupt.
  8179.   del %1
  8180.   echo File %1 had a CRC error and has been deleted.>>arjtest.log
  8181.   goto end
  8182.  
  8183. :ERR2
  8184.   echo  Fatal error! Process aborting.
  8185.  :: Next two lines should be 1 line. Remove "..." from end of next line
  8186.  :: and beginning of following line and rejoin lines before running batch!
  8187.   echo File %1 caused a fatal ARJ error. ARJ header most likely ... ...
  8188. corrupt.>>arjtest.log
  8189.   goto end
  8190.  
  8191. :ERR1
  8192.   echo  Warning! Specified file not found,
  8193.   goto end
  8194.  
  8195. :OK
  8196.   echo  Process was successful, no errors found.
  8197.   echo File %1 checks out OK!>>arjtest.log
  8198.  
  8199. :END of CHK_ARJ.BAT ---------------------------------------------------
  8200.  
  8201.   Hope this helps. Let us know how it works for you....
  8202.  
  8203.  
  8204.  
  8205. -!- SLMAIL v4.0a  (#0304)
  8206.  ! Origin: Free Spirit =*= SL/RIP =*= 301-283-0917 =*= V32b/HST (1:109/132)
  8207.  
  8208. ─ Area: Batch Language Programming                     FI ────────────────────
  8209.   Msg#: 427                                          Date: 12 Jun 96  18:09:52
  8210.   From: Vernon Frazee                                Read: Yes    Replied: No
  8211.     To: Andrew Adams                                 Mark:
  8212.   Subj: Batch Help
  8213. ──────────────────────────────────────────────────────────────────────────────
  8214. AA> Is there any way I can use a batch command to retrieve a line out of
  8215. AA> a file?  For example, say I wanted to retrieve the 3rd line of
  8216. AA> README.TXT. What would I do? Or can you even do this with Batch?
  8217.  
  8218.     If you don't mind the line number surrounded by square brackets
  8219.     preceding the text of the line itself, it can be done right from
  8220.     the DOS prompt. For example, let's say I wanted to see line "3"
  8221.     of a file named FILENAME.TXT:
  8222.  
  8223.        Yo, DOS FIND.EXE,
  8224.        |  number each line
  8225.        |  |  as you DON'T look for
  8226.        |  |  |            this weird string
  8227.        |  |  |            |             in this file.
  8228.        |  |  |            |             |
  8229.        |  |  |            |             |
  8230.        |  |  |            |             |    Wait, you're not done;
  8231.        |  |  |            |             |    |    now look for this.
  8232.     ___| _| _|  __________|  ___________| ___|  __|
  8233.     find /n /v "_!@#$%^&*()" FILENAME.TXT|find "[3]"
  8234.  
  8235.     If the 3rd line in FILENAME.TXT was:
  8236.  
  8237.       We the People of the United States, in order to form a more
  8238.  
  8239.     the above command would display:
  8240.  
  8241.     [3]  We the People of the United States, in order to form a more
  8242.  
  8243.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8244. -!- Terminate 4.00/Pro
  8245.  ! Origin: Terminate point system (1:135/71.17)
  8246.  
  8247. ─ Area: Batch Language Programming                     FI ────────────────────
  8248.   Msg#: 428                                          Date: 12 Jun 96  18:02:44
  8249.   From: Vernon Frazee                                Read: Yes    Replied: No
  8250.     To: MIKE DUTTERA                                 Mark:
  8251.   Subj: COMMAND.COM
  8252. ──────────────────────────────────────────────────────────────────────────────
  8253. MD> If one works mainly in DOS, then I can see the wisdom of a ram drive
  8254. MD> to store frequently used bat files etc., but command.com? Why? isn't
  8255. MD> it already in conventional and upper/high memory RAM after boot-up?
  8256.  
  8257.     When COMMAND.COM is on a RAMDRIVE and the COMSPEC environment is
  8258.     variable pointing to it, it can reload its transient portion much
  8259.     quicker than it can from a hard drive.
  8260.  
  8261.     COMMAND.COM divides itself into two pieces when it is first loaded
  8262.     into memory.  The "resident" part, about 3K or so bytes, sits in the
  8263.     lower end of memory above the the other two DOS files (IO.SYS and
  8264.     MSDOS.SYS).  The "transient" portion -- the bulk of the program --
  8265.     resides up at the very top of user memory.
  8266.  
  8267.     The transient part interprets and executes the DOS internal commands
  8268.     and does BATch file processing.  These facilities are not needed
  8269.     when other programs are running.  By sitting at the top of memory,
  8270.     the transient portion does not take up valuable memory space.  It
  8271.     can be overwritten by other programs if they need the space.
  8272.  
  8273.     When a program exits, it return control to the resident part of
  8274.     COMMAND.COM, which performs a simple checksum calculation of the
  8275.     memory area normally occupied by the transient portion. This way it
  8276.     can tell whether the information loaded in that area of memory is
  8277.     indeed its own transient part or whether the transient part was
  8278.     overwritten.  If it was overwritten, the resident part looks to the
  8279.     COMSPEC environment variable for COMMAND.COM's location and then
  8280.     reloads the transient portion of itself back into memory.
  8281.  
  8282.     That's why exiting from a large program can cause a disk access when
  8283.     COMMAND.COM is reloaded into memory.  Some programs -- like Lotus
  8284.     1-2-3 and many compilers -- always use that top memory area, so this
  8285.     can happen frequently.
  8286.  
  8287.     (Note: 98% of the above was taken from the old original but still
  8288.            good "PC Magazine DOS Power Tools, Techniques, Tricks and
  8289.            Utilities" by Paul Somerson).
  8290.  
  8291.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8292. -!- Terminate 4.00/Pro
  8293.  ! Origin: Terminate point system (1:135/71.17)
  8294.  
  8295. ─ Area: Batch Language Programming                     FI ────────────────────
  8296.   Msg#: 434                                          Date: 14 Jun 96  11:26:00
  8297.   From: Roy Reed                                     Read: Yes    Replied: No
  8298.     To: Ingrid Dekker                                Mark:
  8299.   Subj: every third time
  8300. ──────────────────────────────────────────────────────────────────────────────
  8301. *ZV{Ingrid-
  8302.    Here is a jobbie that will do the stuff every third time, but
  8303. I'm not using numbers to count with, seeing it's only three counts.
  8304. Just run this and follow the echoes.  This could easily be expanded,
  8305. but maybe you want to use numbers 1, 2 and 3.  I'm not sure.
  8306. Oh well, going for the early input.
  8307. CYAH.
  8308. Roy
  8309. ------------------------------------------------------------------
  8310. ::doafter3.bat
  8311. @ECHO OFF
  8312. IF EXIST C:\FIRSTONE GOTO TWOTOGO
  8313. ECHO FIRSTONE>C:\FIRSTONE
  8314. ECHO TWO MORE TIMES TO GO BEFORE IT GETS DONE!
  8315. GOTO END
  8316. :TWOTOGO
  8317. IF EXIST C:\SECOND1 GOTO ONETOGO
  8318. ECHO SECOND1>C:\SECOND1
  8319. ECHO NEXT TIME IT GETS DONE!
  8320. GOTO END
  8321. :ONETOGO
  8322. FOR %%X IN (FIRSTONE SECOND1) DO DEL C:\%%X>NUL
  8323. ECHO GOING TO DO THE THINGS NOW
  8324. ECHO PUT YOUR STUFF TO DO HERE
  8325. :END
  8326. -------------------------------------------------------------------
  8327. I named it doafter3.bat, but not critical - run the stuff between
  8328. the lines.
  8329.  ! Origin: The GIFfer BBS, 75+gig, (813)969-2761 (1:377/50)
  8330.  
  8331. ─ Area: Batch Language Programming                     FI ────────────────────
  8332.   Msg#: 432                                          Date: 14 Jun 96  06:12:12
  8333.   From: Vernon Frazee                                Read: Yes    Replied: No
  8334.     To: DAVID BATTESTELLA                            Mark:
  8335.   Subj: Batch command  4 "RETURN"
  8336. ──────────────────────────────────────────────────────────────────────────────
  8337. DB> In writing  a batch file what command or combination of characters
  8338. DB> would I use to emulate/simulate hitting the "RETURN" key?
  8339.  
  8340.     You might try something like:
  8341.  
  8342.       VER|name_of_program
  8343.  
  8344.     or:
  8345.  
  8346.       echo.>~tmp
  8347.       name_of_program<~.tmp
  8348.       del ~tmp
  8349.  
  8350.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8351. -!- Terminate 4.00/Pro
  8352.  ! Origin: Terminate point system (1:135/71.17)
  8353.  
  8354. ─ Area: Batch Language Programming                     FI ────────────────────
  8355.   Msg#: 438                                          Date: 18 Jun 96  12:11:17
  8356.   From: Vernon Frazee                                Read: Yes    Replied: No
  8357.     To: Ingrid Dekker                                Mark:
  8358.   Subj: EVERY3RD(time).BAT
  8359. ──────────────────────────────────────────────────────────────────────────────
  8360.     Hello Ingrid,
  8361.  
  8362.     Bat just informed me that I messed up again. ;(  The EXAMPLE.BAT I
  8363.     recently sent to you executed something 3 times instead of executing
  8364.     something every 3rd time.  Sorry for the confusion.  The following
  8365.     attempt appears to be working here with nary a hitch.
  8366.  
  8367.       @echo off
  8368.       :EVERY3RD.BAT ----------------------------------------
  8369.        if (%1)==() goto Begin
  8370.        if (%1)==(/1) goto Begin
  8371.       :Syntax ----------------------------------------------
  8372.        cls
  8373.        echo.
  8374.        echo     Name: EVERY3RD.BAT
  8375.        echo.
  8376.        echo  Purpose: Run what is under label ":RunIt" only
  8377.        echo           every 3rd time this BATch is launched.
  8378.        echo.
  8379.        echo   Syntax: EVERY3RD [/?][/1]
  8380.        echo.
  8381.        echo    Where: The /? option displays this brief help
  8382.        echo       or: the /1 option resets the count to 1.
  8383.        echo.
  8384.        echo Requires: DOS's FIND (somewhere in the PATH) and
  8385.        echo           20 bytes free environment space.
  8386.        echo.
  8387.        echo    Notes: This BATch file is self-modifying!
  8388.        echo           It keeps track of the number of times
  8389.        echo           run at the end of itself.  Hence, all
  8390.        echo           4 occurrences of "C:\BAT" below MUST
  8391.        echo           be changed to the location where you
  8392.        echo           store this BATch file.
  8393.        echo.
  8394.        echo           Do NOT use the ".BAT" extension when
  8395.        echo           launching this BATch file.
  8396.        echo.
  8397.        goto End
  8398.       :Begin -----------------------------------------------
  8399.        for %%x in (:) do set ~colons~=%%x%%x!
  8400.        if (%1)==(/1) goto Reset
  8401.        find /c "%~colons~%" C:\BAT\%0.BAT>~tmp~.bat
  8402.        echo set ~tmp~=%%2>--------.bat
  8403.        for %%x in (call del) do %%x ~tmp~.bat
  8404.        del --------.bat
  8405. -->    if not (%~tmp~%)==(3) goto AddOne
  8406.       :RunIt -----------------------------------------------
  8407.        echo This is the area where you insert the
  8408.        echo sequence of commands you want to run
  8409.        echo every 3rd time this BAT is launched.
  8410.       :Reset -----------------------------------------------
  8411.        type C:\BAT\%0.BAT|find /v "%~colons~%">C:\BAT\%0.BAT
  8412.       :AddOne ----------------------------------------------
  8413.        echo %~colons~%>>C:\BAT\%0.BAT
  8414.       :Cleanup ---------------------------------------------
  8415.        for %%x in (colons tmp) do set ~%%x~=
  8416.       :End (Data storage begins below) --------------- -vjf-
  8417.       ::!
  8418.  
  8419.     You can change the number "3" in the line marked with the "-->"
  8420.     to whatever number suits your needs.
  8421.  
  8422.     EVERY3RD.BAT was designed as self-modifying BATch file simply to
  8423.     save room on the hard drive. (No extra files).
  8424.  
  8425.     Let me know if this is still not quite what you had in mind.
  8426.  
  8427.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8428. -!- Terminate 4.00/Pro
  8429.  ! Origin: Terminate point system (1:135/71.17)
  8430.  
  8431. ─ Area: Batpower ─────────────────────────────────────────────────────────────
  8432.   Msg#: 82                                           Date: 23 Jun 96  01:12:00
  8433.   From: Mike Zeleski                                 Read: Yes    Replied: No
  8434.     To: Andrew Adams                                 Mark:
  8435.   Subj: Setcursor
  8436. ──────────────────────────────────────────────────────────────────────────────
  8437. AA>Hello!
  8438.  
  8439. AA>I need some kind of utilitie that can set my cursor in a specific
  8440. AA>row/column  that I can distribute freely with a batch program...
  8441.  
  8442. Before I tell you this, I would like it clear that I'm not trying to
  8443. make you go duhhh...
  8444.  
  8445. However there is an utility that ships with every copy of Dos that can
  8446. do this. "ANSI.SYS"
  8447.  
  8448. But of course you have to have it loaded for the ansi escape sequence to
  8449. work.  A friend of mine used such ansi code in a batch program to
  8450. simulate a flag waving in the wind.  So @echo'ed ansi sequences can get
  8451. quite elaborate...
  8452.  
  8453. In this case I'm going to use * = [Esc] here as I don't know how it
  8454. would come through here.
  8455.  
  8456. To create the Esc in Dos Edit, hit [ctrl] + P, then hit [Esc], you will
  8457. then see the backwards pointing arrow that is the Esc character.  It is
  8458. also the standard ASCII letter 27, so some editors may be able to create
  8459. it by hitting [alt] + 27...
  8460.  
  8461. Examples
  8462.  
  8463. echo*[5,10H
  8464. echo*[5,10f
  8465.  
  8466.  Both should move the cursor to row 5 column 10.
  8467.  
  8468. echo*[3A
  8469.  
  8470. This should move the Cursor up 3 rows.
  8471.  
  8472. echo*[3B
  8473.  
  8474. This should move the Cursor down 3 rows.
  8475.  
  8476. echo*[8D
  8477.  
  8478. This should move the Cursor left 8 spaces.
  8479.  
  8480. echo*[s
  8481.  
  8482. Saves current cursor location.
  8483.  
  8484. echo*[u
  8485.  
  8486. Return to saved location.
  8487.  
  8488. echo*[2J
  8489.  
  8490. Clears screen and moves cursor to the home position. (aka 1,1)
  8491. -!-
  8492.  * OLXWin 1.00b * I'm Warped, I know, How can you Warp something so twisted?
  8493.  
  8494. -!- WILDMAIL!/WC v4.12
  8495.  ! Origin: Father & Son*610-439-1509*Whitehall Pa  (1:2607/112.0)
  8496.  
  8497. ─ Area: Batch Language Programming                     FI ────────────────────
  8498.   Msg#: 448                                          Date: 25 Jun 96  23:40:00
  8499.   From: David Mohorn                                 Read: Yes    Replied: No
  8500.     To: Brett Todd                                   Mark:
  8501.   Subj: Upcasing %1, etc. inputs
  8502. ──────────────────────────────────────────────────────────────────────────────
  8503. BT>@PID: TerMail 4 EVALUATION
  8504.   >@MSGID: 2:251/31.2 cca89588
  8505.   >Hi there All,
  8506.  
  8507. BT>Could someone please tell me how to upcase a %1 or %2, etc. input to a batch
  8508.   >file, so if %1 was "brett", it would be displayed as "BRETT".
  8509.  
  8510. How about:
  8511.  
  8512. SET OLDPATH=%PATH%
  8513. SET PATH=%1
  8514. SET NAME=%PATH%
  8515. SET PATH=%OLDPATH%
  8516. SET OLDPATH=
  8517. ECHO Hello, %NAME%
  8518.  
  8519.  
  8520. RIME: ->1369 FIDO: (1:275/102) INTERNET: david.mohorn@sourcebbs.com
  8521.  
  8522. -!-
  8523.  ■ QMPro 1.53 ■ I smoked Marijuana but didn't exhale and still haven't.
  8524.  ! Origin:  (1:275/102)
  8525.  
  8526. ─ Area: Batch Language Programming                     FI ────────────────────
  8527.   Msg#: 443                                          Date: 30 Jun 96  12:21:00
  8528.   From: Horst Schaeffer                              Read: Yes    Replied: No
  8529.     To: Roy Reed                                     Mark:
  8530.   Subj: multiple commands on dir files
  8531. ──────────────────────────────────────────────────────────────────────────────
  8532. -=> quoting Roy Reed to Carlos Legaspi (25 Jun 96) <=-
  8533.  
  8534. RR> [...]
  8535. RR>    Each file in turn gets called as a parameter (%%x becomes %2)
  8536. RR> and gets passed to :carlos for processing (called recursion).
  8537. RR> --------------------------------------
  8538. RR> if "%1"=="carlos" goto carlos
  8539. RR> for %%x in (*.*) do call %0 carlos %%x
  8540. RR> goto end
  8541. RR> :carlos
  8542. RR> [commands with %2]
  8543. RR> :end
  8544. RR> --------------------------------------
  8545.  
  8546. How about this one:
  8547.  
  8548.     %2 for %%x in (*.*) do call %0 %%x REM
  8549.     %2 goto end
  8550.     [commands with %1]
  8551.     :end
  8552.  
  8553. Horst.
  8554.  
  8555. ... Q4FM 2.10a ... horst@confusion.rmc.de
  8556.  
  8557. -!- FM 2.02
  8558.  ! Origin: Don't follow leaders! (2:2480/13.75)
  8559.  
  8560. ─ Area: Batch Language Programming                     FI ────────────────────
  8561.   Msg#: 423                                          Date: 29 Jun 96  11:11:30
  8562.   From: Horst Ehm                                    Read: Yes    Replied: No
  8563.     To: Andrew Kennedy                               Mark:
  8564.   Subj: saving prompt
  8565. ──────────────────────────────────────────────────────────────────────────────
  8566. Hallo Andrew!
  8567.  
  8568. Antwort auf eine Message von Andrew Kennedy an All:
  8569.  
  8570.  AK> CAn someone show me how I can save my prompt setting in a variable so
  8571.  AK> I can restore it later after it has been changed. Thanks
  8572.  
  8573. Your settings are already saved in the e-var PROMPT.
  8574. You can write the contents of PROMPT to another e-var and vice versa as shown
  8575. below.
  8576.  
  8577.   @set old_prmt=%prompt%
  8578.   @prompt DOS   = $v$_Time  = $t
  8579.   @echo off
  8580.   prompt %old_prmt%
  8581.   set old_prmt=
  8582.  
  8583.  
  8584. Horst
  8585.  
  8586. -!-
  8587.  ! Origin: Multitasking  ->  Auf dem Klo lesen ! (2:241/225)
  8588.  
  8589. ─ Area: Batch Language Programming                     FI ────────────────────
  8590.   Msg#: 430                                          Date: 08 Jul 96  13:02:36
  8591.   From: Andy Guess                                   Read: Yes    Replied: No
  8592.     To: Mike Stewart                                 Mark:
  8593.   Subj: Dates
  8594. ──────────────────────────────────────────────────────────────────────────────
  8595.  MS> Im wondering how to go about having a batch file that will
  8596.  MS> change the computer's date to a specified date(by me), before
  8597.  MS> running a program, and then changing it back to the origional date
  8598.  MS> upon exiting the program.
  8599.  
  8600. Save this as DATEBACK.BAT.
  8601.  
  8602. +=+=+=+=+=+=+=+=+==+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  8603. @echo off
  8604. ver|date>date!!!!.bat
  8605. echo set date=%%4>current.bat
  8606. call date!!!!
  8607. date %1
  8608. rem Your program here
  8609. date %date%
  8610. set date=
  8611. for %%f in (date!!!! current) do del %%f.bat
  8612. +=+=+=+=+=+=+=+=+==+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  8613.  
  8614. Edit the file so it runs whatever program you like (line 6). If you type
  8615.  
  8616. DATEBACK 1-1-99
  8617.  
  8618. then the date will be set to 1-1-99, then the program will be run, then the
  8619. date will be restored. You'll lose a few seconds while the program runs, of
  8620. course. If run without any parameters, it will prompt you for a date.
  8621.  
  8622. Hope this works for you.
  8623.  
  8624. {Write Back!} [/^\ndy Guess]
  8625. .!. Shut up, Spock!  We're rescuing you!  --McCoy
  8626. -!- Terminate 4.00
  8627.  ! Origin: -AG {andy.guess@myplace.blkcat.com} (1:109/570.15)
  8628.  
  8629. ─ Area: Batch Language Programming                     FI ────────────────────
  8630.   Msg#: 446                                          Date: 10 Jul 96  15:06:32
  8631.   From: Vernon Frazee                                Read: Yes    Replied: No
  8632.     To: Roland Ribi                                  Mark:
  8633.   Subj: Put the date in a textfile
  8634. ──────────────────────────────────────────────────────────────────────────────
  8635. RR> Does anyone know how I can put the actual date with a type command
  8636. RR> or however into a Text file? Thanks for the information!
  8637.  
  8638.       @echo off
  8639.       :GETDATE.BAT
  8640.       :Puts the current system date
  8641.       :in a file named GETDATE.DAT.
  8642.        ver|date>~.bat
  8643.        echo set date=%%4>current.bat
  8644.        for %%x in (call del) do %%x ~.bat
  8645.        del current.bat
  8646.        echo %date%
  8647.        echo %date%>GETDATE.DAT
  8648.        set date=
  8649.       :End
  8650.  
  8651.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8652. -!- Terminate 4.00/Pro
  8653.  ! Origin: Terminate point system (1:135/71.17)
  8654.  
  8655. ─ Area: Batch Language Programming                     FI ────────────────────
  8656.   Msg#: 450             Local                        Date: 16 Jul 96  13:56:05
  8657.   From: Bat Lang                                     Read: Yes    Replied: No
  8658.     To: All                                          Mark:
  8659.   Subj: Batch Book
  8660. ──────────────────────────────────────────────────────────────────────────────
  8661. From time to time we get asked to recommend a good book on batch files.
  8662. For that reason it is a topic covered in our BAT-FAQ1.ZIP, recently
  8663. hatched into the BFDS FDN, and avail at our BFDS sites and FTP site (see
  8664. 'Echo rules', elsewhere in this pkt).  That topic in the FAQ looks like:
  8665.  
  8666.  
  8667.                           THE BATPOWER FAQ,
  8668.                     or Frequently Asked Questions
  8669.  
  8670. |     ***              Last revision: 28 Jun 96              ***
  8671.  
  8672.                 [... text deleted for brevity ...]
  8673.  
  8674.  
  8675. 26.                 BATCH PROGRAMMING BOOKS
  8676.                     ~~~~~~~~~~~~~~~~~~~~~~~
  8677.   While the following books have been recommended by various echo
  8678.   users, any choice should always be based on your personal
  8679.   examination of the book, to ensure that it meets your needs.
  8680.  
  8681.    DOS Power Tools                         by  Paul Somerson
  8682.  
  8683.    Supercharging MS-DOS                    by  Van Wolverton
  8684.  
  8685.    MS-DOS Batch File Programming           by  Ronny Richardson
  8686.  
  8687.    Advanced MS-DOS Batch File Programming  by  Dan Gookin
  8688.  
  8689.    Concise Guide to MS-DOS Batch Files     by  Kris Jamsa
  8690. ---------------< cut here >-
  8691.  
  8692. The first four are 'original inhabitants' in the FAQ and, no matter what
  8693. else their merits, they are dated.  Which brings me to the last one,
  8694. added by me after a recommendation here by Greg Miskelly, our Irish
  8695. bard (author of GMUTILS3.ZIP {BFDS} which contains PSIS, a dandy batch
  8696. enhancer).  At the time, I snipped his msg to a note file, as:
  8697.  
  8698. > As far as books are concerned, the best book I have encountered for
  8699. > starting off with is:
  8700. >
  8701. >    Concise Guide to MS-DOS Batch Files
  8702. >       by Kris Jamsa
  8703. >    Microsoft Press
  8704. >       for   Beginning, Intermediate and Reference
  8705. >    ISBN 1-55615-638-3
  8706. >    USA $12.95
  8707. >
  8708. > It's good points are:
  8709. >
  8710. >    It's affordable.
  8711. >    It does _not_ have a diskette full of already prepared batch
  8712. >       files whereby you don't learn anything.
  8713. >    It is really very well put together.
  8714. >    The author is a DOS _expert_; I have other books by him that
  8715. ---------------< cut here >-
  8716.  
  8717. Ever since he posted these words (27 Aug 95) I have tried to find a cy
  8718. of this book.  In April I intensified the search, special ordering it
  8719. from two specialty book stores.  I never heard back from either of them,
  8720. after several followups.  I finally FAXed the publisher, and got back a
  8721. form letter with an 800 number?  This only led to a referral to the
  8722. publishers 800 #.  To make a long story short (finally), after about ten
  8723. more phone calls, I located a single cy in our local Software ETC. which
  8724. handles mostly software, some hardware and books.
  8725.  
  8726. Now that I have had a chance to look it over, I can add an enthusiastic
  8727. endorsement to what Greg had to say above.  The publisher indicates it
  8728. went out of print about the time of Greg's posting, last summer.  The
  8729. reason that I am telling you all of this is that you will need to strike
  8730. while the iron is not stone cold, if you are to find a cy.  The
  8731. International distribution is listed as:
  8732.  
  8733. In Canada, by Macmillan of Canada
  8734. In USA by, the publisher, Microsoft Press
  8735. In the rest of the world, by Penguin Books Ltd.
  8736.   Penguin Books Ltd, Harmondsworth, Middlesex, England
  8737.   Penguin Books Australia Ltd, Ringwood, Victoria, Australia
  8738.   Penguin Books N.Z. Ltd, 182-190 Wairau Road, Auckland 10, N.Z.
  8739.  
  8740. Newbies to batch, in particular, are recommended to seek out a cy.
  8741.  
  8742. BTW, it covers MS-DOS versions as recent as 6.2, and is (C)1994.
  8743. Good Modeming!  /\oo/\
  8744.  
  8745. ... NetMail: 1:382/1201 or E-mail: bat.lang@1201.ima.infomail.com
  8746. -!- Blue Wave/Max v2.30
  8747.  ! Origin: The HUB * Austin TX * Centex PCUG * 512-346-1852 (1:382/1201)
  8748.  
  8749. ─ Area: Batch Language Programming                     FI ────────────────────
  8750.   Msg#: 438                                          Date: 15 Jul 96  05:28:01
  8751.   From: Vernon Frazee                                Read: Yes    Replied: No
  8752.     To: Russ Army                                    Mark:
  8753.   Subj: %'s
  8754. ──────────────────────────────────────────────────────────────────────────────
  8755. RA> WHen I was ritin dirzip thingy I had a question.
  8756. RA> I know  %1 is the first werd after the command
  8757. RA>         %2 is the second
  8758. RA>         etc etc
  8759. RA> Is      %f stand for file
  8760. RA>         %w ???
  8761. RA>         others?
  8762. RA> I would be helped greatly if I could know this
  8763.  
  8764.     In the following for-in-do command:
  8765.  
  8766.       for %x in (Russ Army) do echo %x
  8767.  
  8768.     the "%x" is simply the name of a variable.  The "x" in "%x" can be
  8769.     durn near any character you want.  If you type "HELP FOR" (not the
  8770.     quotes) and look under <Notes>, Microsoft states "To avoid confusion
  8771.     with the batch parameters %0 through %9, you can use any character
  8772.     for variable except the numerals 0 through 9."       ~~~
  8773.  
  8774.     That's almost right.  There are 8 characters that will not work:
  8775.  
  8776.       Decimal Character
  8777.       ------- ---------
  8778.          37       %
  8779.          44       ,
  8780.          47       /
  8781.          59       ;
  8782.          60       <
  8783.          61       =
  8784.          62       >
  8785.         124       |
  8786.  
  8787.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8788. -!- Terminate 4.00/Pro
  8789.  ! Origin: Terminate point system (1:135/71.17)
  8790.  
  8791. ─ Area: Batch Language Programming                     FI ────────────────────
  8792.   Msg#: 441                                          Date: 19 Jul 96  09:47:00
  8793.   From: Benjamin Ng                                  Read: Yes    Replied: No
  8794.     To: Andrew Adams                                 Mark:
  8795.   Subj: Commenting ZIP files....
  8796. ──────────────────────────────────────────────────────────────────────────────
  8797. Greetings Andrew!
  8798.  
  8799. 07-17-96 (22:48), Andrew Adams wrote to All about Commenting ZIP files....:
  8800.  
  8801.  AA> Does anyone know how I can make  a batch file to add comments
  8802.  AA> to ALL the zip files in 1 directory???????
  8803.  
  8804. Try this 1-liner:
  8805.  
  8806. @for %%x in (.\*.ZIP) do pkzip.exe -z %%x < zcomment.txt
  8807.  
  8808. It will use the current directory unless you substitute with your
  8809. own path (yourpath\*.ZIP).  Use a full pathname for the zcomment.txt
  8810. file if applicable.
  8811.  
  8812. Regards,
  8813. Ben.
  8814.  
  8815. -!- Maximus 2.02
  8816.  ! Origin: EXCESS - CALGARY ALBERTA CANADA (403)285-7338 (1:134/17)
  8817.  
  8818. ─ Area: Batch Language Programming                     FI ────────────────────
  8819.   Msg#: 446                                          Date: 24 Jun 96  03:12:10
  8820.   From: GARY SMITH                                   Read: Yes    Replied: No
  8821.     To: ROY REED                                     Mark:
  8822.   Subj: for-in-do goto
  8823. ──────────────────────────────────────────────────────────────────────────────
  8824. RR> This was in the batpwr01.zip.  Can anybody do some splainin
  8825.   > why it doesn't (?apparently?) got to labels 1 and 2?
  8826.   > --------------------------------------
  8827.   > @echo off
  8828.   > for %%n in (1 2 3) do goto %%n
  8829.   > echo Fell through!
  8830.   > goto end
  8831.   > :1
  8832.   > echo Hit label 1
  8833.   > goto end
  8834.   > :2
  8835.   > echo Hit label 2
  8836.   > goto end
  8837.   > :3
  8838.   > echo Hit label 3
  8839.   > : end
  8840.  
  8841. The combination of FOR/IN/DO with GOTO is extremely peculiar.
  8842. When COMMAND.COM executes a GOTO, it stores the label, opens the
  8843. batch file, and reads lines from the beginning until it locates
  8844. the label or exhausts the file.  It has only one place to store
  8845. the target label, and thus will remember only the last label it
  8846. saw.  When you combine a FOR with an unconditional GOTO, the
  8847. transfer will always be to the last label.  When the the GOTO is
  8848. conditional, the transfer will be to the last label for which
  8849. the condition is true.
  8850. -!-
  8851.  ■ OLX 1.53 ■ All we are saying is, "Give pizza chants."
  8852.  ! Origin: The Inner Circle, Pickerington, Oh (614)861-8377 (1:226/110)
  8853.  
  8854. ─ Area: Batch Language Programming                     FI ────────────────────
  8855.   Msg#: 447                                          Date: 24 Jun 96  03:12:10
  8856.   From: GARY SMITH                                   Read: Yes    Replied: No
  8857.     To: MARC GRIFFIN                                 Mark:
  8858.   Subj: full delete...
  8859. ──────────────────────────────────────────────────────────────────────────────
  8860. MG>  WS> find to associate with it. Hence, using Norton Unerase (or was it
  8861.   >  WS> Undelete) with the Manual option on, it only takes a minute to recover
  8862.   >  WS> a file which has been deleted, then recreated and deleted again. I
  8863.   >  WS> think this kind of explains my reasons for posting. Besides, anyone
  8864.   >  WS> else reading this who didn't already know, is now aware of how to eras
  8865.   >  WS> and over- write a file from Batch :-)
  8866.   > I've only just joined this area... Wouldn't it be okay to just copy a file
  8867.   > OVER the file you are trying to delete?
  8868.  
  8869. Not if you use the COPY command.  COMMAND.COM's COPY function
  8870. does not overwrite the clusters which currently belong to the
  8871. file.  The data is written into newly-allocated clusters and the
  8872. old ones are freed.  Since recent versions of DOS postpone the
  8873. re-allocation of freed clusters as long as possible, the original
  8874. data will most likely hang around for quite a while.  I've just
  8875. tested this under DOS 6.22 and was able to recover the original
  8876. data in a few seconds with Norton DiskEdit (version 4.5, I think).
  8877. Vernon's QBASIC solution ought to work, though, since it must
  8878. necessarily write to the original clusters.
  8879. -!-
  8880.  ■ OLX 1.53 ■ IneedsignificantlymoreroominthislineforwhatI*really*want.
  8881.  ! Origin: The Inner Circle, Pickerington, Oh (614)861-8377 (1:226/110)
  8882.  
  8883. ─ Area: Batch Language Programming                     FI ────────────────────
  8884.   Msg#: 442                                          Date: 24 Jul 96  17:21:00
  8885.   From: Mike Zeleski                                 Read: Yes    Replied: No
  8886.     To: Dave Fleming                                 Mark:
  8887.   Subj: Compiled .BAT?
  8888. ──────────────────────────────────────────────────────────────────────────────
  8889. DF>Gidday again,
  8890.  
  8891. DF>  I heard somewhere that there is such a thing as BAT2COM or BAT2EXE or
  8892. DF>something that will convert a batch file into an executable program.  Is
  8893. DF>this even within the realm of reality?
  8894.  
  8895. There were several "Batch Compilers" that were written over the years.
  8896.  
  8897. DF>  I assume it could be done, but the compiler would have to do a LOT of
  8898. DF>searching to include programs that are elsewhere on the disk! <g>
  8899.  
  8900. Nope; it just has to shell into the external program like any other
  8901. programing language can. Just don't move that program out of the path or
  8902. you may "break" your compiled code...
  8903.  
  8904. DF>I also assume someone is pulling my leg, how efficient could something
  8905. DF>like this be?
  8906.  
  8907. Actually if the program was optimized to allow Nulls and Redirection to
  8908. remain in memory, and optimize many of BFP's slower instructions, the
  8909. compiled version often can be remarkably faster with large Bats...
  8910.  
  8911. Look for a book Titled Builder Lite; Developing Dynamic Batch Files.
  8912. (With Program Disk.) By Ronny Richardson, Windcrest/McGraw-Hill, 1993.
  8913. Summary: Programming Language Reference with Editor and Compiler.
  8914.  
  8915. (May be out of print now, but you may be able to find it second hand.)
  8916.  
  8917. Builder & Builder Lite should be available from:
  8918.  
  8919. Hyperkinetix, Inc.
  8920. 18001 Irvine Blvd, Suite H
  8921. Tustin, CA 92680
  8922. -!-
  8923.  * OLXWin 1.00b * Espresso: An Ultra Efficient caffeine delivery system.
  8924.  
  8925. -!- WILDMAIL!/WC v4.12
  8926.  ! Origin: Father & Son*610-439-1509*Whitehall Pa  (1:2607/112.0)
  8927.  
  8928. ─ Area: Batch Language Programming                     FI ────────────────────
  8929.   Msg#: 388                                          Date: 25 Jul 96  16:28:58
  8930.   From: Vernon Frazee                                Read: Yes    Replied: No
  8931.     To: Cameron Clark                                Mark:
  8932.   Subj: directories & loops[q]
  8933. ──────────────────────────────────────────────────────────────────────────────
  8934.                                                       25-Jul-1996 16:28
  8935.     Hello Cameron,
  8936.  
  8937.     On 21-Jul-96 at 17:47:26, "All" and "Cameron Clark" were discussing
  8938.     "directories & loops[q]":
  8939.  
  8940. CC> Is there any way to loop thru the directory names as well as file
  8941. CC> names? I notice that on the following scenerio that directories are
  8942. CC> exempt from the listing: [assume there are several directories named
  8943. CC> folder??]
  8944. CC>   for %%c in (folder??.*) do (some list of instructions)
  8945. CC> It there a way to iterate thru directories? Also, is it possible to
  8946. CC> have the loop iterate executing a list of instuctions each time?
  8947.  
  8948.     Place the following SWEEP.BAT in a directory that is in your PATH:
  8949.  
  8950.       @echo off
  8951.       :SWEEP.BAT - Original from PC Computing
  8952.        if not (%1)==() goto Begin
  8953.       :Syntax -----------------------------------------------------
  8954.        echo    Name: SWEEP.BAT
  8955.        echo Purpose: Execute specified command in every directory
  8956.        echo  Syntax: SWEEP command [parameters]
  8957.        goto End
  8958.       :Begin ------------------------------------------------------
  8959.        if (%1)==(?) goto Syntax
  8960.        if (%1)==(/?) goto Syntax
  8961.        set SWEEP=%1 %2 %3 %4 %5 %6 %7 %8 %9
  8962.        cls
  8963.        echo Creating a list of all directories on current drive ...
  8964.        echo @prompt set CurrentDIR=$p>tmptmp.bat
  8965.        command /e:2048 /c tmptmp.bat>director.bat
  8966.        del tmptmp.bat | call director.bat
  8967.        echo @echo off>director.bat
  8968.        echo prompt $g$h>>director.bat
  8969.        echo cd %%1>>director.bat
  8970.        echo %%SWEEP%%>>director.bat
  8971.        echo cd %%CurrentDIR%%>>director.bat
  8972.        chkdsk/v|find "Directory"|find "%CurrentDIR%">tmptmp.lst
  8973.        echo exit>>tmptmp.lst
  8974.        command<tmptmp.lst
  8975.        echo Processing complete.
  8976.       :Cleanup ----------------------------------------------------
  8977.        for %%x in (tmptmp.lst director.bat) do if exist %%x del %%x
  8978.        for %%x in (CurrentDIR SWEEP) do set %%x=
  8979.       :End --------------------------------------------------------
  8980.  
  8981.     To give you an example of what it can do, the following command will
  8982.     delete all "*.BAK" files in every directory on drive C:.
  8983.  
  8984.       sweep del *.bak
  8985.  
  8986.     Note: Since SWEEP.BAT starts with your current directory and then
  8987.           proceeds through every subdirectory under it, to get it to go
  8988.           through every subdirectory on drive C:, the above command
  8989.           would have to be issued from the root directory of drive C:.
  8990.  
  8991.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  8992.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  8993. -!- Terminate 4.00/Pro
  8994.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  8995.  
  8996. ─ Area: Batch Language Programming                     FI ────────────────────
  8997.   Msg#: 447             Rec'd                        Date: 30 Jul 96  17:08:00
  8998.   From: Jim Talbot                                   Read: Yes    Replied: No
  8999.     To: Kent Anderson                                Mark:
  9000.   Subj: directories & loops[q]
  9001. ──────────────────────────────────────────────────────────────────────────────
  9002.  
  9003. KA>SWEEP.COM, by Charles Petzold, is also in PC Mag utilities, volume 1.
  9004. KA>I use it from time to time to move all archived files into one
  9005. KA>directory, to delete BAK and TMP files, etc. A very handy utility to
  9006. KA>have, even though it dates back to 1986.
  9007.  
  9008. Another use for that handy little SWEEP.COM is in conjunction with
  9009. Undelete. I wrote a simple little bat to call up SWEEP AND UNDELETE. The
  9010. command SWPUNDEL now causes UNDELETE to scan each dir and subdir in
  9011. turn. This can be handy if you accidentally delete something and it
  9012. doesn't show up in the undelete list of the directory  from which you
  9013. think it disappeared. This has saved my bacon.exe a few times. It is
  9014. simply amazing how those deleted files manage to hide in the most
  9015. unlikely places.
  9016.  
  9017.  
  9018.  * SLMR 2.1a * Coles' Law: Thinly Sliced Cabbage.
  9019.  
  9020. -!- TriToss (tm) Professional 10.0 - #225
  9021.  ! Origin: The OutDoor Experience 902-461-4713 (1:251/32.0)
  9022.  
  9023. ─ Area: Batch Language Programming                     FI ────────────────────
  9024.   Msg#: 442                                          Date: 08 Aug 96  08:15:08
  9025.   From: Vernon Frazee                                Read: Yes    Replied: No
  9026.     To: Rob Oosten                                   Mark:
  9027.   Subj: Fc or comp return errorlevels?
  9028. ──────────────────────────────────────────────────────────────────────────────
  9029.                                                        8-Aug-1996 08:15
  9030.     Hello Rob,
  9031.  
  9032.     On 23-Jul-96 at 16:17:03, "Vernon Frazee" and "Rob Oosten" were
  9033.     discussing "Fc or comp return errorlevels?":
  9034.  
  9035. AK> Does either fc or comp return errorlevels, and if so what are they
  9036. AK> for files which do NOT match.
  9037.  
  9038. VF> Unfortunately no, not in any of the MS-DOS versions just tried here.
  9039.  
  9040. RO> But there's a way around it, at least for FC. FIND does have
  9041. RO> errorlevels!
  9042. RO>   @echo off
  9043. RO>   del differ
  9044. RO>   fc %1 %2>>differ
  9045. RO>   type differ|find "*****"
  9046. RO>   echo.
  9047. RO>   if errorlevel 2 echo    Something went wrong!!
  9048. RO>   if errorlevel 1 if not errorlevel 2 echo     No differences found!!
  9049. RO>   if errorlevel 0 if not errorlevel 1 beep
  9050. RO>   echo.
  9051. RO> When FC finds differences these are output with ***** lines
  9052. RO> alternating between defining the start (with filename) and the end
  9053. RO> of a difference section.
  9054. RO> When no differences are found the ***** lines will not be written.
  9055. RO> FIND will throw up when differences are found between executable
  9056. RO> files because of the lo-ASCII characters. But you only need to find
  9057. RO> the first ***** line, isn't it?!
  9058.  
  9059.     Here's another approach that doesn't depend on errorlevels at all:
  9060.  
  9061.       @echo off
  9062.       :COMPARE.BAT - Compare two specified files
  9063.        if (%2)==() goto Syntax
  9064.        if (%1)==(?) goto Syntax
  9065.        if (%1)==(/?) goto Syntax
  9066.        if not exist %1 goto File1err
  9067.        if not exist %2 goto File2err
  9068.       :Begin
  9069.        fc %1 %2|find "FC: no differences encountered">~.tmp
  9070.        copy ~.tmp+,,>nul
  9071.        if exist ~.tmp goto NoDifferences
  9072.        echo Files "%1" and "%2" are different
  9073.        goto End
  9074.       :NoDifferences
  9075.        echo Files "%1" and "%2" are the same
  9076.        goto End
  9077.       :File1err
  9078.        echo Couldn't locate file %1
  9079.        goto End
  9080.       :File2err
  9081.        echo Couldn't locate file %2
  9082.        goto End
  9083.       :Syntax
  9084.        echo COMPARE [d:][\path]filename.[ext] [d:][\path]filename.[ext]
  9085.       :End
  9086.  
  9087. RO> I don't know COMP but probably one could do something similar.
  9088.  
  9089.     Yep.  Here's a variation on the above that uses COMP instead of FC:
  9090.  
  9091.       @echo off
  9092.       :COMPARE.BAT - Compare two specified files
  9093.        if (%2)==() goto Syntax
  9094.        if (%1)==(?) goto Syntax
  9095.        if (%1)==(/?) goto Syntax
  9096.        if not exist %1 goto File1err
  9097.        if not exist %2 goto File2err
  9098.       :Begin
  9099.        ctty nul
  9100.        echo n|comp %1 %2|find "Files compare OK">~.tmp
  9101.        ctty con
  9102.        copy ~.tmp+,,>nul
  9103.        if exist ~.tmp goto NoDifferences
  9104.        echo Files "%1" and "%2" are different
  9105.        echo.
  9106.        goto End
  9107.       :NoDifferences
  9108.        echo Files "%1" and "%2" are the same
  9109.        echo.
  9110.        goto End
  9111.       :File1err
  9112.        echo Couldn't locate file %1
  9113.        goto End
  9114.       :File2err
  9115.        echo Couldn't locate file %2
  9116.        goto End
  9117.       :Syntax
  9118.        echo COMPARE [d:][\path]filename.[ext] [d:][\path]filename.[ext]
  9119.       :End
  9120.  
  9121.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9122.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9123. -!- Terminate 4.00/Pro
  9124.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9125.  
  9126. ─ Area: Batch Language Programming                     FI ────────────────────
  9127.   Msg#: 444                                          Date: 12 Aug 96  17:57:00
  9128.   From: Rob Oosten                                   Read: Yes    Replied: No
  9129.     To: Richard Moore                                Mark:
  9130.   Subj: Choice
  9131. ──────────────────────────────────────────────────────────────────────────────
  9132. Richard,
  9133.  
  9134.       on: 03 August 1996 at 19:57
  9135.       you wrote
  9136.       to: All
  9137.  
  9138.  RM> Hi,
  9139.  RM>    I was wondering how I could make a simple batch
  9140.  RM> file(s) like a menu kind of thing useing dos's
  9141.  RM> choice.com??
  9142.  
  9143. Like this:
  9144.  
  9145.  
  9146. ==================================================
  9147. ==    ========== Begin quote menu.bat ==========
  9148.  
  9149. @echo off
  9150. :START
  9151. cls
  9152. echo.
  9153. echo.
  9154. echo   What is it you want to do?
  9155. echo.
  9156. echo      A Nothing
  9157. echo      B Something
  9158. echo      C WordPerfect 5.1 DOS
  9159. echo      D WfW 3.11
  9160. echo      E Aldus PageMaker
  9161. echo      F Corel Draw
  9162. echo      G Word for Windows 6.0
  9163. echo      H FD/GoldED
  9164. echo      I Cookery Book
  9165. echo      J Count my batches
  9166. echo      K . . .
  9167. echo      L . . .
  9168. echo      M . . .
  9169. echo      N . . .
  9170. echo.
  9171. echo      Q Quit to DOS
  9172. echo.
  9173. say   Hit the key of your choice . . . .
  9174. choice /c:ABCDEFGHIJKLMNQ /n
  9175. echo.
  9176. if errorlevel 15 if not errorlevel 16 goto END
  9177. if errorlevel 14 if not errorlevel 15 echo . . .
  9178. if errorlevel 13 if not errorlevel 14 echo . . .
  9179. if errorlevel 12 if not errorlevel 13 echo . . .
  9180. if errorlevel 11 if not errorlevel 12 echo . . .
  9181. if errorlevel 10 if not errorlevel 11 call countum
  9182. if errorlevel 9 if not errorlevel 10 call cookum
  9183. if errorlevel 8 if not errorlevel 9 call fd
  9184. if errorlevel 7 if not errorlevel 8 call winword
  9185. if errorlevel 6 if not errorlevel 7 call wincorel
  9186. if errorlevel 5 if not errorlevel 6 call winaldus
  9187. if errorlevel 4 if not errorlevel 5 call win
  9188. if errorlevel 3 if not errorlevel 4 call wp
  9189. if errorlevel 2 if not errorlevel 3 echo My choice? . . .
  9190. if errorlevel 1 if not errorlevel 2 echo It's your choice . . .
  9191. goto START
  9192. :END
  9193.  
  9194. ==    ========== End quote menu.bat ==========
  9195. ==================================================
  9196.  
  9197.  
  9198. Just make sure this file is in your path. Also the other batches to start the
  9199. applications have to be in your path.
  9200.  
  9201. Make sure these applications/batches all end with errorlevel 0 and you'll
  9202. always return to the menu screen.
  9203.  
  9204. Cheerio,
  9205.  
  9206. Rob
  9207.  
  9208.  
  9209. -!- GED 2.50+/GEcho 1.11+/FD
  9210.  ! Origin: Point Suameer via ProgTel Drachten / Netherlands (2:500/100.6047)
  9211.  
  9212. ─ Area: Batch Language Programming                     FI ────────────────────
  9213.   Msg#: 446                                          Date: 13 Aug 96  14:46:06
  9214.   From: Vernon Frazee                                Read: Yes    Replied: No
  9215.     To: Mike Hill                                    Mark:
  9216.   Subj: CHANGE Program
  9217. ──────────────────────────────────────────────────────────────────────────────
  9218.                                                       13-Aug-1996 14:46
  9219.     Hello Mike,
  9220.  
  9221.     On 10-Aug-96 at 14:54:00, "Roy Reed" and "Mike Hill" were discussing
  9222.     "CHANGE Program":
  9223.  
  9224. MH> I now need to find a way to add a <012> character to the end of each
  9225. MH> file (page feed character). Can you suggest something which will do
  9226. MH> this?
  9227.  
  9228.     Here's one way to do it.  First you need a one-byte file containing
  9229.     nothing but the FormFeed character (ASCII 12 / [Ctrl-L]). (I say
  9230.     "nothing but" here because you probably do NOT want the addiional
  9231.     carriage-return line-feed characters that would be right after the
  9232.     FormFeed character if you used an editor or the DOS echo command).
  9233.  
  9234.     Change to the directory containing your files and type: COPY CON FF
  9235.     The cursor will drop down a line and be waiting for you to type in
  9236.     something.  Press [Ctrl-L], [Ctrl-Z], then [Enter] and DOS will
  9237.     respond with "1 file(s) copied".  Here, it'll look like this:
  9238.  
  9239.       G:\>copy con ff
  9240.       ^L^Z
  9241.               1 file(s) copied
  9242.  
  9243.     Now you can use the COPY command to append the contents of your new
  9244.     FF file to the end of each of your files with a for-in-do command:
  9245.  
  9246.       for %x in (AEW01*.ASC) do copy %x+ff
  9247.  
  9248. MH> Once this is done, then I need to copy all files (395 of them total)
  9249. MH> and add them into one big file. The following command will do that,
  9250. MH> but I am open to suggestions on better ways:
  9251. MH>
  9252. MH>   FOR %a in (AEW01*.ASC) do TYPE %a >>BOOK
  9253.  
  9254.     That'll do it, assuming all of the files are in the correct order
  9255.     of course.  If they're not, you'd either have to get them sorted
  9256.     correctly first or use something like:
  9257.  
  9258.       copy book+awew0101.asc+awew0102.asc+awew0103.asc+awew0104.asc
  9259.       copy book+awew0105.asc+awew0106.asc+awew0107.asc+awew0108.asc
  9260.       ...
  9261.       copy book+awew0392.asc+awew0393.asc+awew0394.asc+awew0395.asc
  9262.  
  9263.     (a major pain!) or maybe something like:
  9264.  
  9265.       @echo off
  9266.       :MAKEBOOK.BAT ------------------------------------------
  9267.       :Open a 0-byte file named BOOK
  9268.        rem>book
  9269.       :Initialize COUNT variable
  9270.        set COUNT=0
  9271.       :Initialize temporary count file
  9272.        rem>temptemp.dat
  9273.       :OnesLoop ----------------------------------------------
  9274.       :Increment the count by 1
  9275.        echo !>>temptemp.dat
  9276.        find "!" /c temptemp.dat>temptemp.bat
  9277.        echo set COUNT=%%2>--------.bat
  9278.        call temptemp.bat
  9279.       :Does the require file exist?
  9280.        if not exist awew000%COUNT%.asc goto Err
  9281.       :Display what's happening
  9282.        echo COPYing BOOK+AWEW000%COUNT%.ASC ...
  9283.       :Append file BOOK
  9284.        copy book+awew000%count%.asc>nul
  9285.        if not (%COUNT%)==(10) goto OnesLoop
  9286.       :TensLoop ----------------------------------------------
  9287.       :Increment the count by 1
  9288.        echo !>>temptemp.dat
  9289.        find "!" /c temptemp.dat>temptemp.bat
  9290.        echo set COUNT=%%2>--------.bat
  9291.        call temptemp.bat
  9292.       :Does the require file exist?
  9293.        if not exist awew000%COUNT%.asc goto Err
  9294.       :Display what's happening
  9295.        echo COPYing BOOK+AWEW00%COUNT%.ASC ...
  9296.       :Append file BOOK
  9297.        copy book+awew00%count%.asc>nul
  9298.        if not (%COUNT%)==(100) goto TensLoop
  9299.       :HundredsLoop ------------------------------------------
  9300.       :Increment the count by 1
  9301.        echo !>>temptemp.dat
  9302.        find "!" /c temptemp.dat>temptemp.bat
  9303.        echo set COUNT=%%2>--------.bat
  9304.        call temptemp.bat
  9305.       :Does the require file exist?
  9306.        if not exist awew000%COUNT%.asc goto Err
  9307.       :Display what's happening
  9308.        echo COPYing BOOK+AWEW0%COUNT%.ASC ...
  9309.       :Append file BOOK
  9310.        copy book+awew0%count%.asc>nul
  9311.        if not (%COUNT%)==(396) goto HundredsLoop
  9312.        goto Cleanup
  9313.       :Err ---------------------------------------------------
  9314.        echo The next required AWEW file (#%COUNT%) is missing!
  9315.       :Cleanup -----------------------------------------------
  9316.        set COUNT=
  9317.        for %%x in (bat dat) do del temptemp.%%x
  9318.        del --------.bat
  9319.       :End ---------------------------------------------------
  9320.  
  9321.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9322.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9323. -!- Terminate 4.00/Pro
  9324.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9325.  
  9326. ─ Area: Batch Language Programming                     FI ────────────────────
  9327.   Msg#: 447                                          Date: 13 Aug 96  15:47:03
  9328.   From: Vernon Frazee                                Read: Yes    Replied: No
  9329.     To: Steve Rischke                                Mark:
  9330.   Subj: Ver command
  9331. ──────────────────────────────────────────────────────────────────────────────
  9332.                                                       13-Aug-1996 15:47
  9333.     Hello Steve,
  9334.  
  9335.     On 11-Aug-96 at 00:53:00, "All" and "Steve Rischke" were discussing
  9336.     "Ver command":
  9337.  
  9338. SR> I am looking for a command thet will check the version of the
  9339. SR> opperating system & then process a command based upon what it finds.
  9340. SR> I am running dos & OS/2.  I want something to check when in a dos
  9341. SR> window from OS/2 to see if it's the cerrent system run this command
  9342. SR> as well as the ability to check if it's the dos system.  This being
  9343. SR> accomplished in seperate lines is great.
  9344. SR>
  9345. SR> eg.  if ver = msdos 6.20 then lh cdrom.com
  9346. SR>      if ver = OS/2 3.0  then lh cdrom2.com
  9347.  
  9348.     You might try something like this:
  9349.  
  9350.       @echo off
  9351.       :Are we running MS-DOS?
  9352.        ver|find "MS-DOS Version 6.22"
  9353.        if errorlevel 0 if not errorlevel 1 goto MSDOS
  9354.       :Must be running OS/2
  9355.        lh cdrom2.com
  9356.        goto End
  9357.       :MSDOS
  9358.        lh cdrom.com
  9359.       :End
  9360.  
  9361.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9362.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9363. -!- Terminate 4.00/Pro
  9364.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9365.  
  9366. ─ Area: Batch Language Programming                     FI ────────────────────
  9367.   Msg#: 441                                          Date: 21 Aug 96  20:00:23
  9368.   From: Gerry Ellison                                Read: Yes    Replied: No
  9369.     To: Wayne Allen                                  Mark:
  9370.   Subj: Date files
  9371. ──────────────────────────────────────────────────────────────────────────────
  9372. WA>        does anyone know how I insert a date into a filename in a
  9373. WA> batch file. the idea is to save a log file each night automatically
  9374. WA> so at the end of say a week I have 7 seperate files... do'nt have to
  9375. WA> be dated although it would be nice numbers would also do i.e Jan 1st
  9376. WA> is LG001.txt and Christmas day is LG365.txt......
  9377.  
  9378.               ------------------- <TMT> --------------------
  9379. Hello Wayne!
  9380.       Try this with ARJ.  run as often as you want.
  9381.  
  9382.       save.bat
  9383.       ARJ m BB -h# Max01.log Bink_01.log -jm
  9384.       ARJ m -v1440r50K #96logs BB??????.ARJ
  9385.  
  9386.       Makes #96LOGS .ARJ
  9387.       that contains
  9388.       BB960630 ARJ
  9389.       which contains
  9390.       MAX01.LOG
  9391.       BINK_01.LOG
  9392.  
  9393. Regards,  Gerry
  9394. -!- timEd 1.10+
  9395.  ! Origin: The Mountain Top Genealogy BBS *OH* 513-921-5568 V34+ (1:108/107)
  9396.  
  9397. ─ Area: Batch Language Programming                     FI ────────────────────
  9398.   Msg#: 434                                          Date: 21 Aug 96  22:52:20
  9399.   From: Larry Nelson                                 Read: Yes    Replied: No
  9400.     To: All                                          Mark:
  9401.   Subj: Comx.bat
  9402. ──────────────────────────────────────────────────────────────────────────────
  9403.          ALL:
  9404.  
  9405.       Use #1 for the script produced by Vernons COM2BAT.BAT
  9406.  
  9407.  :: COMX.BAT/DOS 6.20
  9408.  :: Repository and database for .com utilities.
  9409.  @echo off
  9410.  cls
  9411.       if not %1! == ! goto %1
  9412.    echo.
  9413.    echo     Welcome to COMX, the Store House for all those little
  9414.    echo     Batch utilities that are cluttering your \utl directory
  9415.    echo     and taking up disk space with less that cluster size
  9416.    echo     files.
  9417.    echo.
  9418.    echo     Input a utility name from the list below and COMX
  9419.    echo     will crank out a .com program for you, of the same name.
  9420.    echo     If you already know which utility you need COMX.BAT
  9421.    echo     may be called from the command line with a parameter
  9422.    echo     equal to the name of your choice. Name only, no .ext.
  9423.    echo.
  9424.    echo     Please make sure that Debug, Qbasic, Find and Mode are
  9425.    echo     in path, and you have at least 50 bytes of DOS
  9426.    echo     Environment space. Ctrl/c now or....
  9427.    echo     When prompted for input. Input  x  to exit COMX.BAT
  9428.    echo     .....If you need to check on these requirements.
  9429.    echo.
  9430.    echo     Calling Comx with a parameter of "utls", less quots,
  9431.    echo     will bring to the screen a bare list of names. Bypassing
  9432.    echo     this screen and the more discriptive list of utilities.
  9433.    echo.
  9434.          pause
  9435.  
  9436.  :: Discriptive list of .coms starts here.
  9437.  
  9438.    echo.
  9439.    echo  BORDER:
  9440.    echo     Border.com sets border color from the command line
  9441.    echo     or can be called from a Batch file.
  9442.    echo.
  9443.    echo     SYNTAX = border n
  9444.    echo            Where n = 0 = Black
  9445.    echo                      1 = Blue
  9446.    echo                      2 = Green
  9447.    echo                      3 = Cyan
  9448.    echo                      4 = Red
  9449.    echo                      5 = Magenta
  9450.    echo                      6 = Brown
  9451.    echo                      7 = White
  9452.    echo                      8 = Grey
  9453.    echo                      9 = Bright blue
  9454.    echo                      a = Bright green
  9455.    echo                      b = Bright cyan
  9456.    echo                      c = Bright red
  9457.    echo                      d = Bright magenta
  9458.    echo                      e = Yellow
  9459.    echo                      f = Bright white
  9460.    echo.
  9461.    echo.
  9462.  
  9463.  :: This demo holds only one stored utility. In theroy it could
  9464.  :: hold as many as you might care to install.
  9465.  
  9466.    echo     Please input your choice by name only, no .ext.....
  9467.       fc con nul/lb1/n|date|find " 1: ">ente2.bat
  9468.    echo set npt=%%5>enter.bat
  9469.    call ente2
  9470.       for %%q in (!x !) do if %npt%! == %%q goto cleanup
  9471.    %0 %npt%
  9472.  :border
  9473.       if not %1! == ! set npt=%1
  9474.    echo Creating %npt%.COM ...
  9475.    echo n%npt%.com>%npt%.scr
  9476.    echo e0100 BE 80 00 8B 0C 32 ED E3 31 FE C9 46 46 8A 1C 80>>%npt%.scr
  9477.    echo e0110 FB 30 72 1B 80 FB 39 76 10 80 E3 DF 80 FB 41 72>>%npt%.scr
  9478.    echo e0120 0E 80 FB 46 77 09 80 EB 07 80 EB 30 EB 06 90 E2>>%npt%.scr
  9479.    echo e0130 DB EB 07 90 B4 0B 32 FF CD 10 CD 20 28 63 29 20>>%npt%.scr
  9480.    echo e0140 31 39 38 38 20 5A 69 66 66 20 43 6F 6D 6D 75 6E>>%npt%.scr
  9481.    echo e0150 69 63 61 74 69 6F 6E 73 20 43 6F 2E>>%npt%.scr
  9482.    echo rcx>>%npt%.scr
  9483.    echo 5C>>%npt%.scr
  9484.    echo w>>%npt%.scr
  9485.    echo q>>%npt%.scr
  9486.       debug<%npt%.scr>nul
  9487.       del %npt%.scr
  9488.       dir %npt%.COM
  9489.    goto cleanup
  9490.  :utls
  9491.    echo Border
  9492.  :cleanup
  9493.       if exist ente?.bat del ente?.bat
  9494.       set npt=
  9495.  :L8r
  9496.  
  9497.       I keep Comx.bat in \utl (in path) and when I run it the
  9498.       resulting utility shows up in the current directory.
  9499.  :L8r
  9500.                  Larry
  9501.             ..... In a pinch a stone ax still works.....
  9502.  
  9503.  
  9504. -!- Maximus 2.02
  9505.  ! Origin: MSDOS MAXIMUS BBS (1:343/101)
  9506.  
  9507. ─ Area: Batch Language Programming                     FI ────────────────────
  9508.   Msg#: 441                                          Date: 24 Aug 96  01:35:00
  9509.   From: Irv Luckom                                   Read: Yes    Replied: No
  9510.     To: Jon Jaeschke                                 Mark:
  9511.   Subj: In Need Of Assistance...
  9512. ──────────────────────────────────────────────────────────────────────────────
  9513. JJ> FF> Just so I understand you, you want to copy everthing in the
  9514. JJ> FF> \AMIPRO\DATA directory onto floppies, and there is more than 1.4mb of
  9515. JJ> FF> files in the DATA directory, so you need to change floppies during the
  9516. JJ> FF> copy, and you want a batch file to automate the process?
  9517.  
  9518. If you have a copy of PKZIP what you want to do can be done in one
  9519. simple step. (If you don't have a copy virtually every BBS I have been
  9520. on has it in its files section.)
  9521.  
  9522. The command is:
  9523.  
  9524.         pkzip -ex -rp -&f [[d:]zipfile name you select] [directory name]
  9525.  
  9526. If you want to use this with different zipfile and directory names you
  9527. could create the following 2 line batch file and name it back.bat:
  9528.  
  9529. @echo off
  9530. pkzip -ex -rp -&f %1 %2
  9531.  
  9532.  
  9533. You would call this batch file with the command:
  9534.  
  9535.         back [[d:]zipfile name you select] [directory name]
  9536.  
  9537. For example: back a:prozip \amipro\data
  9538.  
  9539. The pkzip command will format your backup disks, preserve your
  9540. directory structure, ask you for another disk when it fills the first
  9541. one, and put a directory of all the files backed up on the last disk
  9542. used.
  9543.  
  9544. To reverse this and reload the backed up files to their original
  9545. directories if the backup files are later dates than the files now in
  9546. those directories, the command is:
  9547.  
  9548. pkunzip -d -n a:prozip
  9549.  
  9550. If you want everything you have backed up, delete the -n in the previous
  9551. line.
  9552. ___
  9553.  X SLMR 2.1a X
  9554.  
  9555. -!- Maximus 3.01
  9556.  ! Origin: Eye Of The Storm * West Palm Beach, FL (1:3609/67)
  9557.  
  9558. ─ Area: Batch Language Programming                     FI ────────────────────
  9559.   Msg#: 443                                          Date: 02 Sep 96  08:38:37
  9560.   From: Vernon Frazee                                Read: Yes    Replied: No
  9561.     To: Bill Casey                                   Mark:
  9562.   Subj: Removing ">" sign from text files
  9563. ──────────────────────────────────────────────────────────────────────────────
  9564. BC> Greetings from Birmingham England.
  9565.  
  9566.     Kewl!  Aren't ya'll the ones that frequently use the word "bloody"
  9567.     as an adverb?  8-)
  9568.  
  9569. BC> ... is it possible to write a batch file that would remove the ">"
  9570. BC> sign from the beginning of each line in a text file? ...
  9571.  
  9572.     Here's an example of one way to do it:
  9573.  
  9574.       @echo off
  9575.       :STRIP62.BAT - Strip greater-than symbol (ASCII 62) from the
  9576.       :              beginning of each line in the specified file.
  9577.        if (%1)==() goto Syntax
  9578.        if (%1)==(?) goto Syntax
  9579.        if (%1)==(/?) goto Syntax
  9580.        if not exist %1 goto FileErr
  9581.        goto Initialize
  9582.       :Syntax -------------------------------------------------------
  9583.        echo    Name: STRIP62.BAT
  9584.        echo Purpose: Strip greater-than symbol (ASCII 62) from the
  9585.        echo          beginning of each line in the specified file.
  9586.        echo  Syntax: %0 [d:][\path\]filename.ext
  9587.        echo    Note: Requires QBASIC and FIND (somewhere in PATH) and
  9588.        echo          enough free space in the environment to hold the
  9589.        echo          length of your filename + 16 characters.
  9590.        goto End
  9591.       :Initialize variables -----------------------------------------
  9592.        cls
  9593.        for %%x in (DIR FN FE) do set ~%%x=
  9594.       :Parse specified filename -------------------------------------
  9595.        echo Parsing filename "%1" ...
  9596.        :Put Directory name in evar ~DIR
  9597.         dir %1.|find "Directory">~.bat
  9598.         echo set ~DIR=%%2>director.bat
  9599.         for %%x in (call del) do %%x ~.bat
  9600.         del director.bat
  9601.        :Append "\" to ~DIR?
  9602.         if exist %~DIR%\nul set ~DIR=%~DIR%\
  9603.        :Put filename in evar ~FN and file extension in evar ~FE
  9604.         dir %1.|find /v "e"|find ":">~.bat
  9605.         echo.>>~.bat
  9606.         date<~.bat |find "Enter">~.bat
  9607.         rem ------^------ This space must be here
  9608.         echo set ~FN=%%4>enter.bat
  9609.         echo if exist %%~DIR%%%%4.%%5 set ~FE=%%5>>enter.bat
  9610.         for %%x in (call del) do %%x ~.bat
  9611.         del enter.bat
  9612.       :Create backup copy of original -------------------------------
  9613.        echo Creating backup of "%1" named "%~DIR%%~FN%.BAK" ...
  9614.        copy %1 %~DIR%%~FN%.BAK>nul
  9615.       :Build QBASIC program using specified filename ----------------
  9616.        echo Creating QBASIC program ...
  9617.        echo open "%~DIR%%~FN%.BAK" for input as #1>~.bas
  9618.        echo open "%~DIR%%~FN%.%~FE%" for output as #2>>~.bas
  9619.        echo Count=0>>~.bas
  9620.        echo do until eof(1)>>~.bas
  9621.        echo   line input #1,rec$>>~.bas
  9622.        echo   Count=Count+1:locate ,1:print "Line#:"; Count;>>~.bas
  9623.        echo   if not left$(rec$,1)=chr$(62) then>>~.bas
  9624.        echo     print #2,rec$>>~.bas
  9625.        echo   else>>~.bas
  9626.        echo     print #2,mid$(rec$,2,len(rec$))>>~.bas
  9627.        echo   end if>>~.bas
  9628.        echo loop:print:close:system>>~.bas
  9629.       :DoIt ---------------------------------------------------------
  9630.        echo Stripping leading greater-than symbols
  9631.        echo from each line in file "%~DIR%%~FN%.%~FE%" ...
  9632.        qbasic /run ~.bas
  9633.        del ~.bas
  9634.       :Done ---------------------------------------------------------
  9635.        echo.
  9636.        echo Original file:
  9637.        echo.
  9638.        dir %~DIR%%~FN%.BAK|find ":"
  9639.        echo.
  9640.        echo Stripped file:
  9641.        echo.
  9642.        dir %~DIR%%~FN%.%~FE%|find ":"
  9643.        echo.
  9644.        for %%x in (DIR FN FE) do set ~%%x=
  9645.        echo Processing complete.
  9646.        echo.
  9647.        goto End
  9648.       :FileErr ------------------------------------------------------
  9649.        echo Error: Could not locate file "%1"
  9650.        goto Syntax
  9651.       :End ----------------------------------------------------------
  9652.  
  9653. BC> PS: I hope your back is getting better.
  9654.  
  9655.     Thanks; getting a little better every day.
  9656.  
  9657.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9658.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9659. -!- Terminate 4.00/Pro
  9660.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9661.  
  9662. ─ Area: Batch Language Programming                     FI ────────────────────
  9663.   Msg#: 435                                          Date: 03 Sep 96  20:17:06
  9664.   From: Andy Guess                                   Read: Yes    Replied: No
  9665.     To: Simon Stone                                  Mark:
  9666.   Subj: Thanx
  9667. ──────────────────────────────────────────────────────────────────────────────
  9668.  SS> Thanks to all of you that helped with my problem with the TYPE
  9669.  SS> command, there's just one thing left, |MORE dosn't work on the end
  9670.  SS> of the command..
  9671.  
  9672.  SS> === Cut ===[ t.bat ]===
  9673.  SS> FOR %%A IN (*.MSG) DO TYPE %%A |MORE
  9674.  SS> === Cut ===
  9675.  
  9676.  SS> Why ??
  9677.  
  9678. You can't reliably use redirection symbols with FOR. I would try this
  9679. instead, which uses two batch files.
  9680.  
  9681. +=+=+=+=+ T.BAT +=+=+=+=+
  9682. @for %%a in (*.msg) do call aux.bat %%a
  9683. +=+=+=+=+ T.BAT +=+=+=+=+
  9684.  
  9685. +=+=+=+=+ AUX.BAT +=+=+=+=+
  9686. @more<%1
  9687. +=+=+=+=+ AUX.BAT +=+=+=+=+
  9688.  
  9689. Just type "T" to start it. Hope this helps!
  9690.  
  9691. {Write Back!} [/^\ndy Guess]
  9692. .!. We've secretly replaced the dilithium with new Folgers crystals
  9693. -!- Terminate 4.00
  9694.  ! Origin: -AG {andy.guess@myplace.blkcat.com} (1:109/570.15)
  9695.  
  9696. ─ Area: Batch Language Programming                     FI ────────────────────
  9697.   Msg#: 447                                          Date: 05 Sep 96  08:17:57
  9698.   From: Vernon Frazee                                Read: Yes    Replied: No
  9699.     To: Stefan Mensink                               Mark:
  9700.   Subj: Nul
  9701. ──────────────────────────────────────────────────────────────────────────────
  9702.                                                        5-Sep-1996 08:17
  9703.     Hello Stefan,
  9704.  
  9705.     On 29-Aug-96 at 17:24:14, "Russell Albee" and "Stefan Mensink" were
  9706.     discussing "Nul":
  9707.  
  9708. RA> Is there anyway to use the nul to put a file to so that it cannot be
  9709. RA> recovered?
  9710.  
  9711. SM> ah.. you mean that you want to erase a file from your harddisk and
  9712. SM> it should not be recovered again? maybe you should try this
  9713. SM>   del myfile.ext
  9714. SM>   echo ehe can't get it back huh? >myfile.ext
  9715. SM> this means that part of the file should be directly overwritten so
  9716. SM> that undelete cannot restore it.. though more active protections
  9717. SM> might be able to restore it anyway or at least parts of it..
  9718.  
  9719.     With a sector editor, more than likely every bit of it.
  9720.  
  9721. SM> what could also do is just delete the file and then start defrag or
  9722. SM> whatever defragmentation program and erase all free space ..
  9723.  
  9724.     That'd probably do it.  What I usually recommend is simply copying a
  9725.     larger file over the one to be obliterated and then delete it. Since
  9726.     the copy overwrote whatever was in the file you now have don't have
  9727.     to worry about anyone retrieving it.
  9728.  
  9729.     For example, here's a DIR listing of the original file to be erased:
  9730.  
  9731.       Directory of G:\IRS\VJF\95
  9732.       TAXCHEAT.95         91,022 04-15-96  11:55p
  9733.  
  9734.     And a DIR listing of the file to copy over it:
  9735.  
  9736.       Directory of C:\WINDOWS
  9737.       SETUP    EXE       422,080 03-10-92   3:10a
  9738.  
  9739.     The commands that could be used to to obliterate it then are:
  9740.  
  9741.       G:\IRS\VJF\95>copy c:\windows\setup.exe taxcheat.95
  9742.       G:\IRS\VJF\95>echo Up Yours!>taxcheat.95
  9743.       G:\IRS\VJF\95>del taxcheat.95
  9744.  
  9745.     ;-)
  9746.  
  9747.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9748.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9749. -!- Terminate 4.00/Pro
  9750.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9751.  
  9752. ─ Area: Batch Language Programming                     FI ────────────────────
  9753.   Msg#: 445                                          Date: 11 Sep 96  15:57:23
  9754.   From: Vernon Frazee                                Read: Yes    Replied: No
  9755.     To: Allen Fraley                                 Mark:
  9756.   Subj: call command
  9757. ──────────────────────────────────────────────────────────────────────────────
  9758.                                                       11-Sep-1996 15:57
  9759.     Hello Allen,
  9760.  
  9761.     On 08-Sep-96 at 20:44:00, "Richard Epling" and "Allen Fraley" were
  9762.     discussing "call command":
  9763.  
  9764. AF> I want to run these bat file commands from my nightly maintenance
  9765. AF> imrun.bat file.
  9766. AF>   call c:\allfix\saveit.bat
  9767. AF>   call c:\gecho\saveit.bat
  9768. AF>   call c:\amu\saveit.bat
  9769. AF>   call c:\pb\saveit.bat
  9770. AF>   call c:\im\saveit.bat
  9771. AF> Below is an example of saveit.bat in c:\allfix directory. All
  9772. AF> saveit.bat files are the same in each directory with the exception
  9773. AF> of the file name being zipped up.
  9774. AF>   savit.bat
  9775. AF>   pkzip allfix *.* -ex -rp -whs -Jhrs
  9776. AF>   copy allfix.zip d:\allfix
  9777. AF>   del allfix.zip
  9778. AF> If I run saveit.bat from there home directories, they work just
  9779. AF> fine, zipping up all files and directories. Then the zip files are
  9780. AF> copied to there respective directories on my d: drive for storage.
  9781. AF> But I want to call each one of them from imrun.bat which runs my
  9782. AF> nightly maintenance routine.
  9783. AF> The above call commands do not work from my imrun.bat file. By the
  9784. AF> way, each one of the above directories are in my autoexec path
  9785. AF> statement. Could this be causing me some problems being that the
  9786. AF> bats have the same name? Is there maybe a simpler way to do this?
  9787.  
  9788.     Here's an IMRUN.BAT for you that will do everything you are trying
  9789.     to do in a single command:
  9790.  
  9791.       @for %%x in (allfix gecho amu pb im) do pkzip -ex -rp -whs ...
  9792.                                  ... -Jhrs d:\%%x\%%x.zip c:\%%x\*.*
  9793.  
  9794.       Note: Remove the 3 trailing dots "..." from the end of the 1st
  9795.             line and from the beginning of the 2nd line and join the
  9796.             2 lines together with a space between "-whs" and "-Jhrs".
  9797.  
  9798.     Here are the 5 commands, in order, that will actually be processed
  9799.     as DOS expands the above FOR-IN-DO command:
  9800.  
  9801.        pkzip -ex -rp -whs -Jhrs d:\allfix\allfix.zip c:\allfix\*.*
  9802.  
  9803.        pkzip -ex -rp -whs -Jhrs d:\gecho\gecho.zip c:\gecho\*.*
  9804.  
  9805.        pkzip -ex -rp -whs -Jhrs d:\amu\amu.zip c:\amu\*.*
  9806.  
  9807.        pkzip -ex -rp -whs -Jhrs d:\pb\pb.zip c:\pb\*.*
  9808.  
  9809.        pkzip -ex -rp -whs -Jhrs d:\im\im.zip c:\im\*.*
  9810.  
  9811.     IOW, by using the power of PKZIP and the FOR-IN-DO command, you not
  9812.     only save yourself a lot of grief in trying to keep up with those 6
  9813.     separate BATch file, you also free up 5 clusters worth of valuable
  9814.     hard drive space.
  9815.  
  9816.     Speaking of which, since you are creating 5 separate uniquely named
  9817.     ZIPs anyway you could save even a little more room by deleting the 5
  9818.     separate directories on drive D: and then create all of your backup
  9819.     ZIPs in a single directory, say "D:\BACKUPS":
  9820.  
  9821.       @for %%x in (allfix gecho amu pb im) do pkzip -ex -rp -whs ...
  9822.                              ... -Jhrs d:\backups\%%x.zip c:\%%x\*.*
  9823.  
  9824.     After you get through running this one you would have something like
  9825.  
  9826.        Volume in drive D is DRIVE0_VOL2
  9827.        Directory of D:\BACKUPS
  9828.  
  9829.       ALLFIX   ZIP        51,645 09-11-96   3:57p
  9830.       GECHO    ZIP        42,754 09-11-96   3:57p
  9831.       AMU      ZIP       154,391 09-11-96   3:57p
  9832.       PB       ZIP        14,433 09-11-96   3:57p
  9833.       IM       ZIP     1,759,992 09-11-96   3:57p
  9834.               5 file(s)      2,023,215 bytes
  9835.                            209,699,328 bytes free
  9836.  
  9837.     (instead of each file in a separate directory).
  9838.  
  9839.     Just a thought; either way will work.
  9840.  
  9841.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9842.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9843. -!- Terminate 4.00/Pro
  9844.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9845.  
  9846. ─ Area: Batch Language Programming                     FI ────────────────────
  9847.   Msg#: 446                                          Date: 11 Sep 96  18:26:56
  9848.   From: Vernon Frazee                                Read: Yes    Replied: No
  9849.     To: Richard Morrell                              Mark:
  9850.   Subj: change a line
  9851. ──────────────────────────────────────────────────────────────────────────────
  9852.                                                       11-Sep-1996 18:26
  9853.     Hello Richard,
  9854.  
  9855. RM> Can anyone tell me if theres a way to change ...
  9856.  
  9857.     If deleting ALL of the  >  (greater-than) characters in a file isn't
  9858.     a problem, here's an example of "how to" using EDLIN:
  9859.  
  9860.       @echo off
  9861.       :EXAMPLE of how to strip ">"'s using EDLIN
  9862.        if (%1)==() goto Syntax
  9863.        if (%1)==(?) goto Syntax
  9864.        if (%1)==(/?) goto Syntax
  9865.        if not exist %1 goto FileErr
  9866.       :Create temporary EDLIN script file
  9867.        echo"1,#r>" >~.scr
  9868.        rem -------^------- ASCII 8 (backspace)
  9869.        echo e>>~.scr
  9870.       :Strip ">"'s from the specified file
  9871.        edlin %1<~.scr>nul
  9872.        del ~.scr
  9873.       :Done
  9874.        echo A backup copy of your original file
  9875.        echo was saved with the extension .BAK
  9876.        goto End
  9877.       :FileErr
  9878.        echo  Error: "%1" could not be located
  9879.       :Syntax
  9880.        echo Syntax: EXAMPLE filename[.ext]
  9881.       :End
  9882.  
  9883.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9884.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9885. -!- Terminate 4.00/Pro
  9886.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9887.  
  9888. ─ Area: Batch Language Programming                     FI ────────────────────
  9889.   Msg#: 447                                          Date: 11 Sep 96  16:57:44
  9890.   From: Vernon Frazee                                Read: Yes    Replied: No
  9891.     To: Stefan Mensink                               Mark:
  9892.   Subj: Nul
  9893. ──────────────────────────────────────────────────────────────────────────────
  9894.                                                       11-Sep-1996 16:57
  9895.     Hello Stefan,
  9896.  
  9897.     On 06-Sep-96 at 19:08:09, "Martin Whittaker" and "Stefan Mensink"
  9898.     were discussing "Nul":
  9899.  
  9900. MW> Vernon Frazee posted a little gem here awhile back (now _that's_ an
  9901. MW> understatement :)) - which included a basic routine to do just what
  9902. MW> the originator of this thread was after (I think)....clearing a
  9903. MW> file's contents to "nul" (or all 0's or whatever i.e. meaningless
  9904. MW> data).
  9905.  
  9906. SM> you mean like a program that was written in the lang. basic, to be
  9907. SM> used in batchfiles? in that case .. pity.. otherwise.. i'd be really
  9908. SM> interested how he'd implement that in batch.. you see.. basic
  9909. SM> executables are so awfully big.. ;[
  9910.  
  9911.     It's self-contained.  Here, try it:
  9912.  
  9913.       @echo off
  9914.       :WIPE_IT.BAT v1.10 ------------------------------------
  9915.       :Wipes, renames, and then deletes the specified file.
  9916.       :Begin ------------------------------------------------
  9917.        if not (%1)==() goto CheckParms
  9918.       :Syntax -----------------------------------------------
  9919.        echo    Name: WIPE_IT.BAT v1.10
  9920.        echo Purpose: Wipes, renames, and then deletes the
  9921.        echo          specified file.
  9922.        echo  Syntax: WIPE_IT [d:][\path\]filename[.ext]
  9923.        echo Example: WIPE_IT TAXCHEAT.95
  9924.        echo  Needed: QBASIC and CHOICE (anywhere in PATH)
  9925.        goto End
  9926.       :CheckParms -------------------------------------------
  9927.        if (%1)==(?) goto Syntax
  9928.        if (%1)==(/?) goto Syntax
  9929.        if not exist %1 goto InputErr
  9930.       :Are you sure? ----------------------------------------
  9931.        echo Are you sure you want to wipe file "%1"?
  9932.        choice /c:yn /n "[Y]es or [N]o (Y/N): "
  9933.        if errorlevel 2 goto Abort
  9934.       :Create/Run QBASIC program to wipe file ---------------
  9935.        echo open "%1" for binary as #1>>~.bas
  9936.        echo length=lof(1): close #1>>~.bas
  9937.        echo lines=int(length/512)>>~.bas
  9938.        echo if not length mod 512=0 then>>~.bas
  9939.        echo   lines=lines+1>>~.bas
  9940.        echo end if>>~.bas
  9941.        echo open "%1" for output as #1>>~.bas
  9942.        echo for x=1 to lines>>~.bas
  9943.        echo   locate,1:print "Goal:";lines;" Line:";x;>>~.bas
  9944.        echo   print #1, string$(512,chr$(246));>>~.bas
  9945.        echo next x:close:print:randomize timer>>~.bas
  9946.        echo x$="~"+right$(str$(cdbl(rnd)),7)+".tmp">>~.bas
  9947.        echo name "%1" as x$: kill x$: system>>~.bas
  9948.        qbasic /run ~.bas
  9949.        del ~.bas
  9950.        echo "%1" was wiped, renamed, then deleted.
  9951.        goto End
  9952.       :InputErr ---------------------------------------------
  9953.        echo   Error: "%1" does not exist
  9954.        goto Syntax
  9955.       :Abort ------------------------------------------------
  9956.        echo All processing aborted.
  9957.       :End -------------------------------------------- -vjf-
  9958.  
  9959.  
  9960.     Example:  WIPE_IT  TAXCHEAT.95
  9961.  
  9962.     <g>
  9963.  
  9964.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  9965.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  9966. -!- Terminate 4.00/Pro
  9967.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  9968.  
  9969. ─ Area: Batch Language Programming                     FI ────────────────────
  9970.   Msg#: 449                                          Date: 17 Sep 96  10:11:04
  9971.   From: Larry Nelson                                 Read: Yes    Replied: No
  9972.     To: Jim Danvers                                  Mark:
  9973.   Subj: Need to parse a file
  9974. ──────────────────────────────────────────────────────────────────────────────
  9975.          JIM:
  9976.  
  9977.  Subject: Need to parse text file....
  9978.  
  9979.  JD> We have determined that by simply removing a line from the system.ini
  9980.  JD> file in thier win 3.x systems - the can switch from the local
  9981.  JD> network/Wan to thier ISP.  Easy - but right at the moment the line
  9982.  JD> removal has/is being done manually.  I'd like to come up with a batch
  9983.  JD> solution......
  9984.  
  9985.       What a great use for Batch in the daily hassel of life at
  9986.       the keyboard. You didn't mention just which line needed
  9987.       cutting from System.ini so I chose the one that required the
  9988.       least typing ("type=4")  See what you think of this....
  9989.  
  9990.  ::WanWacker.BAT/DOS 6.22
  9991.  @echo off
  9992.  cls
  9993.       find/v "type=4"<C:\windows\system.ini>C:\windows\system.ini
  9994.  :L8r
  9995.  
  9996.       I tied it to an icon in Windows and it seemed to run nicely.
  9997.  :L8r
  9998.          Larry
  9999.          .....In a pinch a stone ax still works.....
  10000.  
  10001.  
  10002. -!- Maximus 2.02
  10003.  ! Origin: MSDOS MAXIMUS BBS (1:343/101)
  10004.  
  10005. ─ Area: Batch Language Programming                     FI ────────────────────
  10006.   Msg#: 437                                          Date: 23 Sep 96  07:15:18
  10007.   From: Vernon Frazee                                Read: Yes    Replied: No
  10008.     To: WAYNE ALLEN                                  Mark:
  10009.   Subj: Date driven BAT's
  10010. ──────────────────────────────────────────────────────────────────────────────
  10011.                                                       23-Sep-1996 07:15
  10012.     Hello WAYNE,
  10013.  
  10014.     On 17-Sep-96 at 21:31:04, "All" and "WAYNE ALLEN" were discussing
  10015.     "Date driven BAT's":
  10016.  
  10017. WA> How do I get a .BAT to activate automatically on a specific date?,
  10018. WA> preferably once only (I could use sepaphores to do that bit).
  10019.  
  10020.     If you boot your system every day A-N-D your birthday is September
  10021.     23rd, here's an example that can be appended to your AUTOEXEC.BAT:
  10022.  
  10023.     ::------------------------------------------------------------------
  10024.     ::Birthday? - If the current system date is 09-23-(any year), AND we
  10025.     ::have not done so yet this day, display "Happy Birthday!" and pause
  10026.     ::------------------------------------------------------------------
  10027.      ver|date|find " 09-23-"
  10028.      if errorlevel 0 if not errorlevel 1 goto DisplayBirthday?
  10029.      if exist birthday.$$$ del birthday.$$$
  10030.      goto EndBirthDayRoutine
  10031.     :DisplayBirthday? - (Only if "birthday.$$$ does NOT exist) ---------
  10032.      if exist birthday.$$$ goto EndBirthdayRoutine
  10033.      rem>birthday.$$$
  10034.      echo.
  10035.      echo        Happy Birthday!
  10036.      echo.
  10037.      pause
  10038.     :EndBirthdayRoutine ------------------------------------------------
  10039.  
  10040.     Of course this can be easily altered to work with any:
  10041.  
  10042.       Day of the week - have FIND look for "Mon" or "Tue" or "Wed", etc.
  10043.       ~~~~~~~~~~~~~~~
  10044.       Day - have FIND look for "-01-" or "-02-" or "-03-", etc.
  10045.       ~~~   (note the dashes ---^--^ on either side of the numbers)
  10046.  
  10047.       Month - have FIND look for " 01" (Jan) or " 02" (Feb), etc.
  10048.       ~~~~~   (leading spaces ----^--------------^)
  10049.  
  10050.       Friday the 13th - ver|date|find "Fri"|find "-13-"
  10051.       ~~~~~~~~~~~~~~~
  10052.  
  10053.       Anniversary - Some important anniversary/date is September the 5th
  10054.       ~~~~~~~~~~~   and you want a few days advance/repetitive notice so
  10055.                     you hopefully won't forget to purchase something:
  10056.  
  10057.                       ver|date|find " 09-0"
  10058.  
  10059.       etc., etc., etc.
  10060.  
  10061.     And/or then of course to do whatever you need it to do when such
  10062.     proves true (errorlevel 0) and/or false (errorlevel 1).
  10063.  
  10064.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  10065.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  10066. -!- Terminate 4.00/Pro
  10067.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  10068.  
  10069. ─ Area: Batch Language Programming                     FI ────────────────────
  10070.   Msg#: 441                                          Date: 23 Sep 96  16:45:53
  10071.   From: Vernon Frazee                                Read: Yes    Replied: No
  10072.     To: Simon Stone                                  Mark:
  10073.   Subj: Search
  10074. ──────────────────────────────────────────────────────────────────────────────
  10075.                                                       23-Sep-1996 16:45
  10076.     Hello Simon,
  10077.  
  10078.     On 21-Sep-96 at 00:31:47, "All" and "Simon Stone" were discussing
  10079.     "Search":
  10080.  
  10081. SS> Is there a way of making a BAT file to search and delete files on my
  10082. SS> machine ??
  10083.  
  10084.     1) Stick the following SWEEP.BAT in a directory in your PATH
  10085.  
  10086.          @echo off
  10087.          :SWEEP.BAT - Original from PC Computing
  10088.           if not (%1)==() goto Begin
  10089.          :Syntax -----------------------------------------------------
  10090.           echo    Name: SWEEP.BAT
  10091.           echo Purpose: Execute specified command in every directory
  10092.           echo  Syntax: SWEEP command [parameters]
  10093.           goto End
  10094.          :Begin ------------------------------------------------------
  10095.           if (%1)==(?) goto Syntax
  10096.           if (%1)==(/?) goto Syntax
  10097.           set SWEEP=%1 %2 %3 %4 %5 %6 %7 %8 %9
  10098.           cls
  10099.           echo Creating a list of all directories on current drive ...
  10100.           echo @prompt set CurrentDIR=$p>tmptmp.bat
  10101.           command /e:2048 /c tmptmp.bat>director.bat
  10102.           del tmptmp.bat | call director.bat
  10103.           echo @echo off>director.bat
  10104.           echo prompt $g$h>>director.bat
  10105.           echo cd %%1>>director.bat
  10106.           echo %%SWEEP%%>>director.bat
  10107.           echo cd %%CurrentDIR%%>>director.bat
  10108.           chkdsk/v|find "Directory"|find "%CurrentDIR%">tmptmp.lst
  10109.           echo exit>>tmptmp.lst
  10110.           command<tmptmp.lst
  10111.           echo Processing complete.
  10112.          :Cleanup ----------------------------------------------------
  10113.           for %%x in (tmptmp.lst director.bat) do if exist %%x del %%x
  10114.           for %%x in (CurrentDIR SWEEP) do set %%x=
  10115.          :End --------------------------------------------------------
  10116.  
  10117.     2) Type something similar to the following:
  10118.  
  10119.          SWEEP  DEL  the_name_of_the_file_you_want_to_delete_goes_here
  10120.  
  10121.        Note: Since this command would delete ALL files matching the
  10122.              filename you specified in your current directory and each
  10123.              and every subdirectory below it, be careful -- especially
  10124.              with wildcards.  IOW, the command "SWEEP DEL *.*" from the
  10125.              root directory of drive C: could be disastrous.
  10126.  
  10127.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  10128.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  10129. -!- Terminate 4.00/Pro
  10130.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  10131.  
  10132. ─ Area: Batch Language Programming                     FI ────────────────────
  10133.   Msg#: 448                                          Date: 27 Sep 96  00:21:22
  10134.   From: Larry Nelson                                 Read: Yes    Replied: No
  10135.     To: All                                          Mark:
  10136.   Subj: LazyDayz.bat
  10137. ──────────────────────────────────────────────────────────────────────────────
  10138.          ALL:
  10139.  
  10140.       What day does the Fourth of July fall on next year?
  10141.       Don't know huh. Well now you don't have to go asking
  10142.       dumb questions of people that prolly don't know either.
  10143.       Just run  LazyDayz.bat and be no longer damned to the
  10144.       ranks of the ignorant.
  10145.  
  10146.  :: LAZYDAYZ.BAT/DOS 6.22, 7.0
  10147.  :: Determines the day of the week for any date
  10148.  :: from (on my sysem) 01-01-80 to 12-31-2099.
  10149.  @echo off
  10150.  cls
  10151.       if %1! == ! goto hlp
  10152.       ver|date|find "Current">curren1.bat
  10153.    echo set cur=%%4>current.bat
  10154.       call curren1
  10155.    echo %1|date>nul
  10156.       ver|date|find "Current">curren1.bat
  10157.    echo set dow=%%3>current.bat
  10158.       call curren1
  10159.    echo %1 Falls on a %dow%
  10160.    echo %cur%|date>nul
  10161.       del curren?.bat
  10162.       set cur=
  10163.       set dow=
  10164.    goto L8r
  10165.  :hlp
  10166.    echo SYNTAX = dayz (target date)
  10167.    echo.
  10168.    echo     Sample:
  10169.    echo           dayz 12-34-96
  10170.  :L8r
  10171.  
  10172.       BTW this runs faster in when I run it while shelled out
  10173.       of win95 into DOS 7.0.
  10174.  :L8r
  10175.          Larry
  10176.          .....Ina pinch a stone ax still works.....
  10177.  
  10178. -!- Maximus 2.02
  10179.  ! Origin: MSDOS MAXIMUS BBS (1:343/101)
  10180.  
  10181. ─ Area: Batch Language Programming                     FI ────────────────────
  10182.   Msg#: 438                                          Date: 26 Sep 96  10:00:51
  10183.   From: Vernon Frazee                                Read: Yes    Replied: No
  10184.     To: RICHARD BASH                                 Mark:
  10185.   Subj: Capturing date and time
  10186. ──────────────────────────────────────────────────────────────────────────────
  10187.                                                       26-Sep-1996 10:00
  10188.     Hello RICHARD,
  10189.  
  10190.     On 23-Sep-96 at 19:01:25, "ALL" and "RICHARD BASH" were discussing
  10191.     "Capturing date and time":
  10192.  
  10193. RB> I am using MS-DOS 6.22 along with DESWview. How can I creatively
  10194. RB> capture the current date and time in a constantly running batch
  10195. RB> file? Said batch file would check the date and time against a
  10196. RB> desired date (or day) and time and if there was a "hit," the batch
  10197. RB> file would call another batch file. If no "hit," the batch file
  10198. RB> would loop back to the start of the file. This batch file would run
  10199. RB> in a DV window in the background.
  10200.  
  10201.     Here's one simple way to do it:
  10202.  
  10203.       ::------------------------------------------
  10204.       ::Stick the current date and time in evar DT
  10205.       ::------------------------------------------
  10206.         echo prompt %prompt%>userpmpt.bat
  10207.         prompt set dt=$d $t>temptemp.bat
  10208.         command /c temptemp.bat>temptemp.bat
  10209.         for %%x in (call del) do %%x userpmpt.bat
  10210.         for %%x in (call del) do %%x temptemp.bat
  10211.       ::------------------------------------------
  10212.  
  10213.     For example, the string this would leave in the environment right
  10214.     now would be:
  10215.  
  10216.       DT=Thu 09-26-1996 10:03:20.89
  10217.  
  10218.     You could then use FIND (from MS-DOS version 6.nn+) to look for any
  10219.     of the following strings:
  10220.  
  10221.       "Thu"  (Weekday)
  10222.       " 09"  (Month)
  10223.       "-26-" (Day)
  10224.       "96 "  (Year)
  10225.       "10:"  (Hour)
  10226.       ":03:" (Minute)
  10227.  
  10228.     and use its returned errorlevel to determine if you found a hit.
  10229.  
  10230.     For example, is it Monday?
  10231.  
  10232.       set|find "DT="|find "Mon">nul
  10233.       if errorlevel 0 if not errorlevel 1 __________
  10234.  
  10235.     (where "__________" is maybe a "GOTO whatever_label", or "CALL
  10236.     whatever_BATch_file" or do "whatever command") when the current
  10237.     system weekday is Monday.
  10238.  
  10239.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  10240.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  10241. -!- Terminate 4.00/Pro
  10242.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  10243.  
  10244. ─ Area: Batch Language Programming                     FI ────────────────────
  10245.   Msg#: 445                                          Date: 01 Oct 96  19:40:12
  10246.   From: Vernon Frazee                                Read: Yes    Replied: No
  10247.     To: Brian Fields                                 Mark:
  10248.   Subj: Batch by date
  10249. ──────────────────────────────────────────────────────────────────────────────
  10250.                                                        1-Oct-1996 19:40
  10251.     Hello Brian,
  10252.  
  10253.     On 30-Sep-96 at 13:28:53, "Larry Nelson" and "Brian Fields" were
  10254.     discussing "Re: Batch by date":
  10255.  
  10256. BF> Ok... Datecheck is designed to execute certain batch files by name,
  10257. BF> or create certain semaphores depending on the conditions defined by
  10258. BF> the user.  You can execute a batch (or create a semaphore) Daily,
  10259. BF> Weekly, Monthly, User defined interval (x days), Yearly, on a
  10260. BF> specific Date, (MM-DD.BAT),  on a specific day, (Monday.BAT, etc...)
  10261. BF> Can ya handle that?  :)
  10262.  
  10263.     Today, the first line from the output of the command "ver|date" is
  10264.     "Current date is Tue 10-01-1996" which contains quite a bit of info
  10265.     that can be used with FIND.  For example,
  10266.  
  10267.       :On every "Tue" do whatever
  10268.        ver|date|find "Tue">nul
  10269.        if errorlevel 0 if not errorlevel 1 whatever
  10270.  
  10271.       :On every day BUT Sun
  10272.        ver|date|find /v "Sun"
  10273.        if errorlevel 1 whatever
  10274.  
  10275.       :Only on the 1st of every month
  10276.        ver|date|find "-01-">nul
  10277.        if errorlevel 0 if not errorlevel 1 whatever
  10278.  
  10279.       :Only if it's Friday the 13th
  10280.        ver|date|find "Fri"|find "-13-"
  10281.        if errorlevel 0 if not errorlevel 1 echo Horror!
  10282.  
  10283.       :Only on Christmas Day
  10284.        ver|date|find "12-25-">nul
  10285.        if errorlevel 0 if not errorlevel 1 echo Merry Christmas!
  10286.  
  10287.       :Only during October
  10288.        ver|date|find " 10-">nul
  10289.        if errorlevel 0 if not errorlevel 1 whatever
  10290.  
  10291.       :From the 10th thru the 19th of October
  10292.        ver|date|find " 10-1"
  10293.        if errorlevel 0 if not errorlevel 1 Anniversary on the 20th!
  10294.  
  10295.       :Only on Sadie Hawkins day (leap day)
  10296.        ver|date|find "02-29-">nul
  10297.        if errorlevel 0 if not errorlevel 1 whatever
  10298.  
  10299.     etc., etc.
  10300.  
  10301.     I've been using the idea for years and will admit that it does have
  10302.     it's limitations but, it doesn't cost a cent extra and is almost
  10303.     always readily available on millions of DOS machines.
  10304.  
  10305.  -- NetMail: 1:135/71.17    E-Mail: vernon.frazee@sunshine.com     -vjf-
  10306.  -- Main BossNode: SOX! BBS * (305) 821-3317 * Hialeah FL USA * 1:135/71
  10307. -!- Terminate 4.00/Pro
  10308.  ! Origin: Vern's Point * Hollywood Lakes, Florida * USA * (1:135/71.17)
  10309.